这些是我尝试使用正在构建的将Boost用作静态链接库的项目时遇到的新错误。但是,仅此而已的便是汇编。请指教。
提升版本:1.68
Visual Studio版本(社区):15.8.0,最后更新于2018年8月14日。
Severity Code Description Project File Line Suppression State
Error C4643 Forward declaring 'allocator' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 119
Error C4643 Forward declaring 'allocator' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 119
Error C4643 Forward declaring 'allocator' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 119
Error C4643 Forward declaring 'allocator' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 30
Error C4643 Forward declaring 'allocator' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 119
Error C4643 Forward declaring 'allocator' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 30
Error C4643 Forward declaring 'allocator_arg_t' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 49
Error C4643 Forward declaring 'allocator_arg_t' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 49
Error C4643 Forward declaring 'basic_istream' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 47
Error C4643 Forward declaring 'basic_istream' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 47
Error C4643 Forward declaring 'basic_ostream' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 44
Error C4643 Forward declaring 'basic_ostream' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 44
Error C4643 Forward declaring 'basic_string' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 120
Error C4643 Forward declaring 'basic_string' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 120
Error C4643 Forward declaring 'basic_string' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 120
Error C4643 Forward declaring 'basic_string' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 120
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\move\detail\iterator_traits.hpp 33
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\move\detail\iterator_traits.hpp 33
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 43
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 30
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\move\detail\iterator_traits.hpp 33
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\move\detail\iterator_traits.hpp 33
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 43
Error C4643 Forward declaring 'bidirectional_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 30
Error C4643 Forward declaring 'bitset' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 143
Error C4643 Forward declaring 'bitset' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 143
Error C4643 Forward declaring 'bitset' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 143
Error C4643 Forward declaring 'bitset' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 143
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 122
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 122
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 122
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 39
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 34
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 122
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\container\detail\std_fwd.hpp 39
Error C4643 Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard.boost-root\boost\interprocess\detail\std_fwd.hpp 34
Error C4643 Forward declaring 'complex' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 127
Error C4643 Forward declaring 'complex' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 127
Error C4643 Forward declaring 'complex' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 127
Error C4643 Forward declaring 'complex' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 127
Error C4643 Forward declaring 'deque' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 131
Error C4643 Forward declaring 'deque' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 131
Error C4643 Forward declaring 'deque' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 131
Error C4643 Forward declaring 'deque' in namespace std is not permitted by the C++ Standard.boost-root\boost\detail\container_fwd.hpp 131
Error C4643 Forward declaring 'forward_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\move\detail\iterator_traits.hpp 32
Error C4643 Forward declaring 'forward_iterator_tag' in namespace std is not permitted by the C++ Standard.boost-root\boost\move\detail\iterator_traits.hpp 32
答案 0 :(得分:1)
真可惜...现在检查一下:
Visual Studio 2017 15.8版中的错误修复和行为更改
...
转发名称空间std中的声明和定义
C ++标准不允许用户向名称空间std添加前向声明或定义。现在将声明或定义添加到命名空间std或命名空间std中的命名空间会导致未定义的行为。
在将来的某个时候,Microsoft会将位置移至 定义了一些STL类型。发生这种情况时,它将破坏现有的 将前向声明添加到名称空间std的代码。一个新的警告, C4643,有助于识别此类源问题。警告已启用 在 /默认模式下,默认情况下处于关闭状态。它将影响那些 使用 / Wall 或 / WX
进行编译
来自here。
为避免此错误,直到在相关头文件中进行进一步更改以符合标准之前,在添加它们之前将其添加:
#pragma warning( disable : 4643 )
即使从虚幻引擎4内部构建代码,这也将立即解决。
对于手动或从VS内部进行常规MSVC编译,请确保您未使用/WX
进行编译,因为这会使警告变成错误。
此外,我也不建议您将其作为长期解决方案,但是,如果您只是想看到可以成功重新构建它,可以禁用15.3中引入的/permissive
编译器标志帮助执行标准一致性。