我不是一个有经验的程序员。我尝试剪切部分 boost 并将其直接粘贴到我的项目中,这是 Visual Studio 2010 中的 C++ 解决方案。我是这样做的:
- 解压boost库
bootstrap.bat
bjam tools/bcd
- 这创建了目录.\bin.v2\tools\bcp\msvc-10.0\release\link-static\threading-multi\- 将目录更改为上述
- 我写了一个脚本来扫描解决方案中的所有文件,结果是:
noncopyable static_assert ratio thread/locks thread chrono interprocess/mapped_region thread/recursive_mutex crc cstdint interprocess/file_mapping make_shared shared_ptr lexical_cast bcp --boost=C:\Users\xxxxxxxx\boost_1_49_0 noncopyable static_assert ratio thread/locks thread chrono interprocess/mapped_region thread/recursive_mutex crc cstdint interprocess/file_mapping make_shared shared_ptr lexical_cast lexical_cast ./myboost
- 将./myboost复制到解决方案中,设置属性,一切正常,直到我不尝试 #include "boost/chrono.hpp" (例如 #include "boost/lexical_cast.hpp" 没问题)。
boost/chrono.hpp 导致链接器错误:
3>playerMain.obj : 错误 LNK2001: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ)
3>playerMain.obj : 错误 LNK2001: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ)
我是否正确使用 bcp?
我应该怎么做才能让它工作?