Boost包括造成严重破坏 - 但这不是Boost的错
Boost includes wreaks havoc - but it's not Boost's fault
我正在将 Boost 引入我的项目中,一旦我在特定文件中包含 Boost 标头 ( #include <boost/property_tree/ptree.hpp>
),我在 boost 标头中出现错误。
以下是错误的简短片段:
1>c:boostincludeboost-1_57boostmpleval_if.hpp(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:boostincludeboost-1_57boostmpleval_if.hpp(28): error C2143: syntax error : missing ',' before 'sizeof'
1>c:boostincludeboost-1_57boostmpleval_if.hpp(26): error C3747: missing default template parameter : parameter 2
1>c:boostincludeboost-1_57boostmpleval_if.hpp(40): error C2974: 'boost::mpl::if_' : invalid template argument for 'T2', type expected
1> c:boostincludeboost-1_57boostmplif.hpp(56) : see declaration of 'boost::mpl::if_'
1> c:boostincludeboost-1_57boostmpleval_if.hpp(44) : see reference to class template instantiation 'boost::mpl::eval_if<C,__formal>' being compiled
1>c:boostincludeboost-1_57boostmpleval_if.hpp(40): error C2974: 'boost::mpl::if_' : invalid template argument for 'T3', type expected
1> c:boostincludeboost-1_57boostmplif.hpp(56) : see declaration of 'boost::mpl::if_'
1>c:boostincludeboost-1_57boostmpleval_if.hpp(50): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:boostincludeboost-1_57boostmpleval_if.hpp(50): error C2143: syntax error : missing ',' before 'sizeof'
1>c:boostincludeboost-1_57boostmpleval_if.hpp(62): error C2974: 'boost::mpl::if_c' : invalid template argument for 'T1', type expected
我立即想到了命名空间冲突,并删除了所有using namespace std
,但这并没有解决问题。我在另一个位置使用了 Boost 线程,它按预期工作(但该代码现在处于非活动状态且未构建)。
有什么提示吗?
--- 一些注意事项
在VS2013中运行
无需
using namespace std
即可构建和工作的代码
我唯一能想到的是,在提升头文件之前包含的一个头文件中有一个错误。我已经看到它使错误看起来像是在后面包含的标题中。您可以做的一件事可以帮助找到问题,即首先包含所有系统和提升标头,然后包含您自己的标头。
相关文章:
- 为什么这不是解密
- OpenGL,为什么这不是一个立方体?
- 是否有必要使用 std::move?这不是已经是一个右值参考了吗?
- 如果这不是类的"复制构造函数",是否可以移动对象?
- 为什么这不是"调用隐式删除的'QQmlElement'的默认构造函数"中的默认构造函数
- 返回带或不带 *this 的变量的确切方式不同 |这不是关于*此指针|正确性
- 为什么这不是函数模板的部分专业化
- BOOST ::日志是每次运行应用程序时都可能旋转文件
- 观看文件夹和子文件夹以进行文件更改,这不是检测更改
- 如果这不是 boost::lockfree::d etail::freelist 中的错误,我在这里错过了什么
- 为什么这不是正确的生产者消费者模型以及当我使用 stl 队列时导致错误的原因
- 如何使用Boost Ptree来解析像中国人这样的宽字节字符串?Boost版本是Boost_1_64_0
- 使用 boost::asio 是一种便携式方法来查找可用端口号
- 哪些 Boost 库是仅标头的
- 为什么这不是 POD
- Boost包括造成严重破坏 - 但这不是Boost的错
- 访问可调用对象 一个 boost::thread 是用来构造的
- 使用浮点值和铸造的算术运算的错误结果 - 差异很大,我想这不是准确值的情况(429497)?
- 为什么这不是内存泄漏?还是吗?删除不带虚拟析构函数的基类指针
- boost::any_cast(const any&) 使用 const_cast<> -- 这不是潜在的 UB 吗?