C++Boost库中的链接错误

Linking error in C++ Boost library

本文关键字:链接 错误 C++Boost      更新时间:2023-10-16

我是C++Boost库的新手。

我已经在BoostPro Computing网站上安装了Boost 1.51,包括32位和64位版本(位于两个不同的文件夹(Boost_1_51和Boost_1_1_51_x64)。

我尝试使用Visual Studio 2005 SP2(在32位Windows操作系统上)为x64构建,但出现以下错误:

error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ)
error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ)

我在项目配置中进行了库链接(其他include和库目录的提升路径)。例如:

包括:C:\Program Files\boost\boost_1_51_x64\

:C:\Program Files\boost\boost_1_51_x64\lib

有人能帮我找出上面的链接错误吗?

根据以上评论:

我通过重新安装boost库(64位版本)解决了这个问题。也许在我上次安装时出现了一些错误。

我通过手动将"boostrongystem-vc120-mt-1_61.lib"(您的版本会有所不同)添加到项目中来解决这个问题。我使用的是预构建的windows二进制文件https://sourceforge.net/projects/boost/files/boost-binaries/