在Boost标头文件中编译错误.Centos 7失败,在Ubuntu上编译16.04
Compile error in boost header file. Fails on Centos 7, compiles on Ubuntu 16.04
我正在遇到一个奇怪的汇编问题。在解决方面的任何帮助都将不胜感激。我将应用程序链接到Boost库。我需要在CentOS和Ubuntu上编译我的应用程序。一切都在Ubuntu上正常工作,并且相同的代码无法在CentOS 7上编译。错误的位置在Boost中。不确定该问题是否实际上是在提升中,还是其他原因导致错误显示在Boost中。搜索错误时,我遇到了此链接。但是,这个问题是针对较旧版本的Boost。我列出了下面的错误输出:
/usr/local/include/boost/chrono/duration.hpp: In function 'constexpr typename boost::enable_if<boost::mpl::and_<boost::is_convertible<Rep1, typename boost::common_type<Rep1, Rep2>::type>, boost::is_convertible<Rep2, typename boost::common_type<Rep1, Rep2>::type> >, boost::chrono::duration<typename boost::common_type<Rep1, Rep2>::type, Period> >::type boost::chrono::operator*(const boost::chrono::duration<Rep, Period>&, const Rep2&)':
In file included from /usr/local/include/boost/chrono/time_point.hpp:33:0,
from /usr/local/include/boost/thread/lock_types.hpp:22,
from /usr/local/include/boost/thread/lock_algorithms.hpp:11,
from /usr/local/include/boost/thread/locks.hpp:10,
...
/usr/local/include/boost/chrono/duration.hpp:575:34: error: type/value mismatch at argument 1 in template parameter list for 'template<class Rep, class Period> class boost::chrono::duration'
typedef duration<CR, Period> CD;
^
/usr/local/include/boost/chrono/duration.hpp:575:34: error: expected a type, got '13u'
/usr/local/include/boost/chrono/duration.hpp:575:38: error: invalid type in declaration before ';' token
typedef duration<CR, Period> CD;
来自/usr/local/include/boost/chrono/duration.hpp的相应代码:
// Duration *
template <class Rep1, class Period, class Rep2>
inline BOOST_CONSTEXPR
typename boost::enable_if <
mpl::and_ <
boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>,
boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>
>,
duration<typename common_type<Rep1, Rep2>::type, Period>
>::type
operator*(const duration<Rep1, Period>& d, const Rep2& s)
{
typedef typename common_type<Rep1, Rep2>::type CR;
typedef duration<CR, Period> CD;
return CD(CD(d).count()*static_cast<CR>(s));
}
我在CentOS7上遇到此错误。在Ubuntu上没有发生。
Centos版本:
Boost:1.58.0,OS:CentOS 7,C :G 4.8.5
ubuntu版本:
Boost:1.58.0,OS:Ubuntu 16.04,C :G 5.4.0
不确定C 编译器差异是否是问题。CentOS7上的C 编译器的默认版本为4.8.5。顺便说一句,CentOS7上的默认增强版本为1.53.2。我编译并安装了Boost 1.58.0版本,以最大程度地减少变量。任何帮助是极大的赞赏。谢谢。
我的猜测(仅此而已(,基于错误消息,是您拥有的某个地方:
#define CR 13u
这是导致汇编错误。
相关文章:
- 包含模板文件的递归会导致编译失败
- 提升 1.64 单元测试编译失败
- C++模板的模板编译失败
- 使用已删除的函数进行编译失败,并显示 uclibc
- MinGW-w64 编译失败,nullptr_t
- 使用提升线程时编译失败
- 编译花絮 g++, clang++, 使用 libboost -- g++8 编译失败时 g++7 成功;
- CMake + Qt,moc 编译失败,无法实现 QMetaObject 方法(编译器找不到基本 ui 对象的标头?
- 带有引用的std::tuple在clang中编译失败,但在gcc中编译失败
- 解决由于在哈希函数中使用了不完整的类型而导致的编译失败
- 将XCode升级到verison 11.1后,C++编译失败
- 添加类型名会导致程序编译失败
- 将 qi::lexeme 添加到灵气中的规则时编译失败
- 如果我在下面的代码中使用 list 而不是 vector,为什么在我尝试在迭代器之间执行减法的行中编译失败?
- 返回 std::stringstream - 编译失败
- 编译失败:strlen 不是 std 的成员
- MSBuidel - 将资源文件添加到项目后静态库编译失败
- C++ - 在 std::thread 中调用重载函数时编译失败
- QtWebEngine 到嵌入式 Linux 交叉编译失败
- 使用 glibc 2.7 包含路径编译失败