【发布时间】:2021-06-14 23:38:28
【问题描述】:
我的任务是移植一个遗留软件,客户决定在此过程中将 Boost 从 1.34 更新到 1.75。
不幸的是,我在编译时出现了这个问题:
/usr/include/boost/thread/pthread/recursive_mutex.hpp: In instantiation of ‘bool boost::recursive_timed_mutex::timed_lock(const TimeDuration&) [with TimeDuration = boost::xtime]’:
/usr/include/boost/thread/lock_types.hpp:403:30: required from ‘bool boost::unique_lock<Mutex>::timed_lock(const boost::xtime&) [with Mutex = boost::recursive_timed_mutex]’
/usr/include/boost/thread/lock_types.hpp:146:17: required from ‘boost::unique_lock<Mutex>::unique_lock(Mutex&, const TimeDuration&) [with TimeDuration = boost::xtime; Mutex = boost::recursive_timed_mutex]’
{project source file}.hpp:206:118: required from here
/usr/include/boost/thread/pthread/recursive_mutex.hpp:244:31: error: ‘const struct boost::xtime’ has no member named ‘is_pos_infinity’
244 | if (relative_time.is_pos_infinity())
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/boost/thread/pthread/recursive_mutex.hpp:249:31: error: ‘const struct boost::xtime’ has no member named ‘is_special’
249 | if (relative_time.is_special())
| ~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/boost/thread/pthread/recursive_mutex.hpp:253:39: error: no matching function for call to ‘boost::detail::platform_duration::platform_duration(const boost::xtime&)’
253 | detail::platform_duration d(relative_time);
| ^
这里发生了什么让 Boost 对自己不满意,我该如何解决?
【问题讨论】:
-
这会很乏味,但是您应该仔细阅读每个发行说明并检查 boost::thread boost.org/users/history 中的每个 BREAKING CHANGE
-
@AlessandroTeruzzi 我认为这次将与第三方标头发生冲突。我会找到相关的帖子。
-
@sehe 它肯定是在使用 boost::xtime 而不是其他的 xtime;我在任何地方都没有看到任何关于模棱两可符号的信息,并且 xtime 也没有在其他任何地方定义。
-
能分享一下预处理的源码吗
-
@sehe 我分享我的解决方案怎么样? stackoverflow.com/a/67928817/3597718