#include < boost/chrono.hpp> 导致未解析的外部符号,使用 bcp
#include <boost/chrono.hpp> causes unresolved external symbol, bcp used
我不是一个经验丰富的程序员。我尝试将boost的一部分剪切并直接粘贴到我的项目中,该项目是Visual Studio 2010中的C++解决方案。我是这样做的:
- 解压缩boost库
bootstrap.bat
bjam tools/bcd
-这创建了目录。\bin.v2\tools\bcp\msvc-10.0\release\link static\threading multi\- 将目录更改为上述内容
- 我已经编写了一个扫描解决方案中所有文件的脚本,结果是:
不可复制的static_assert比率线程/锁定线程chrono interprocess/mapped_region线程/recursive_mutex crc cstilt interprocess/file_mapping make_shared shared_ptr lexical_cast bcp --boost=C:Usersxxxxxxxxboost_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/lixical_cast.hpp"可以)
-
boost/cochrono.hpp导致链接器错误:
3> playerMain.obj:error LNK2001:未解析的外部符号"class boost::system::error_category const&__cdecl boost:;system::system_categor(void)"(?system_category@system@助推@@YAABVerror_category@12@XZ)
3> playerMain.obj:error LNK2001:未解析的外部符号"class boost::system::error_category const&__cdecl boost:;system::general_category(void)"(?generic_category@system@助推@@YAABVerror_category@12@XZ)
我正确使用bcp吗
我该怎么做才能让它发挥作用?
这里非常清楚地说明了安装Boost以便与Visual Studio一起使用的过程。您不需要编写任何安装脚本。
重要的是要知道,大多数Boost库都只是头库(如Boost.Lexical_Cast),但有些库需要链接到静态库(如Boost.System)。请参阅入门文档的这一部分,了解如何让Visual Studio知道Boost静态库在哪里。
本节仅列出哪些库是而不是标头。有些库(如Boost.Cchrono和Boost.Asio)本身只是头,但它们依赖于需要链接到程序中的Boost.System
。
希望这能有所帮助。
- 在函数内部的声明中初始化数组,并在外部使用它
- 使外部项目可用于find_package CMake
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- C++:来自外部文件的Trivia
- 从函数角度看ID到文件路径的内部与外部映射
- C++:将外部库链接到dll库
- spdlog标头仅与外部fmt一起使用.spdlog错误:'内部':不是'fmt'
- 节俭并发:未解决的外部问题
- 如何在c++中从git建立外部库
- 未解析的外部符号_MsiLocateComponentW@12.
- 如何使用对C函数和类对象的外部调用来处理C++头文件
- 具有外部"c"和程序集的未定义函数
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 在C++中使用 gRPC 时未解析的外部符号
- 在类函数中初始化外部作用域变量
- 如果全局变量默认是外部变量,为什么要添加"extern"关键字?
- 调用外部函数,无法指定类型 C++/MVS
- 同时具有"外部"和"内联"说明符的变量
- #include < boost/chrono.hpp> 导致未解析的外部符号,使用 bcp