【发布时间】:2018-06-19 21:10:30
【问题描述】:
这几天我一直在努力解决这个问题。我尝试下载和编译最新的 boost 1.67.0,以包含
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/process.hpp>
但是我在尝试编译时遇到了下面看到的错误(我注意到的一件事是路径在错误日志中出现了错误的斜线,我不知道如何解决这个问题?
我尝试使用标准 cmd 以及 Visual Studio 2013 提示符进行编译(结果相同)。
然后我尝试从 boost 站点获取预编译版本
boost_1_67_0-msvc-12.0-32.exe
我仍然遇到同样的问题。 #include 文本在编辑器中没有下划线。我还有其他包含目录指向:
C:\VisualStudioLibraries\boost_1_67_0
并将附加库目录链接到
C:\VisualStudioLibraries\boost_1_67_0\stage\lib
有谁知道如何解决这个问题?如果我注释掉 #include 行以进行 boost 代码编译没有任何问题并且程序运行。我的代码还没有使用 boost 中的任何东西,所以里面唯一与 boost 相关的东西是 3 #include 行。
错误是:
1> MyForm.cpp 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(65): 错误 C3646: 'noexcept': 未知覆盖说明符 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(72): 错误 C2660: 'boost::process::process_error::process_error' : 函数不接受 2 个参数 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(77): 错误 C2660: 'boost::process::process_error::process_error' : 函数不接受 2 个参数 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(82): 错误 C2440: '' : 无法从 'std::error_code' 转换为 'boost::process::process_error' 1> 没有构造函数可以采用源类型,或者构造函数重载决议不明确 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(88): 错误 C2440: '' : 无法从 'const std::error_code' 转换为 'boost::process::process_error' 1> 没有构造函数可以采用源类型,或者构造函数重载决议不明确 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(94): 错误 C2660: 'boost::process::process_error::process_error' : 函数不接受 2 个参数 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(97): 错误 C2146: 语法错误: 缺少';'在标识符“Char”之前 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(97): 错误 C2146: 语法错误: 缺少';'在标识符“null_char”之前 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(97):错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持默认整数 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(98): 错误 C2144: 语法错误: 'char' 前面应该有 ';' 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(98):错误C2143:语法错误:缺少';'在'C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(99): 错误 C2143: 语法错误: 缺少';'前 '{' 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(99): error C2447: '{' : missing function header (old-style form list?) 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(101): 错误 C2146: 语法错误: 缺少';'在标识符“Char”之前 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(101): 错误 C2146: 语法错误: 缺少';'在标识符“等号”之前 1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(101):错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持默认整数 ========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========
非常感谢大家。
【问题讨论】:
-
如果您坚持使用 Visual Studio 2013,我会退后并使用较旧的 boost。我知道 boost-1.64 可以工作,因为我在 Visual Studio 2013 中使用它。
-
我试试看。谢谢!我的链接呢?这两个是唯一需要设置的东西吗?这些是正确的目录吗?我仍然对错误日志中显示的 Unix 样式“/”感到困惑,而不是 Windows 样式“\”,这不正常吗?
-
Visual Studio 中的大多数路径都可以使用 / 或 \。我几乎一直使用 /。
-
试过 1.64,同样的问题...我使用的是预编译版本,所以不能编译。我什至尝试制作一个全新的空白项目并简单地添加#include
并编译。不去了..嗯 -
VS2013 不支持 'noexcept' 的解决方法可能是在包含 boost 标头之前定义 BOOST_NO_CXX11_NOEXCEPT。