2

我目前正在尝试在 VS2010 中构建在 VS2008 中开发的解决方案。出于设计目的,项目必须使用 v90 工具集构建,并具有 v3.5 的目标框架。在转换向导完成导入的项目后,我已经完成并将它们的每个目标框架/工具集更改为这些值。这些项目使用以下 boost 库:thread、system、regex 和 date_time。我已经在 VS2010 命令提示符下使用以下命令将这些库从 boost_1_47 版本构建到 v90 工具集:b2 toolset=msvc-9.0 –build-type=complete –with-'libraryname'。

在 C++ 附加包含目录中引用了到 boost 根文件夹的链接,并且在链接器附加库目录中引用了内置库的 boost lib 文件夹。我正在为 32 位平台构建。

尝试构建解决方案时,出现以下错误:

Error   17  error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::thread::operator struct boost::detail::thread_move_t<class boost::thread>(void)" (__imp_??Bthread@boost@@QAE?AU?$thread_move_t@Vthread@boost@@@detail@1@XZ)

Error   18  error LNK2001: unresolved external symbol "__declspec(dllimport) public: class boost::thread & __thiscall boost::thread::operator=(struct boost::detail::thread_move_t<class boost::thread>)" (__imp_??4thread@boost@@QAEAAV01@U?$thread_move_t@Vthread@boost@@@detail@1@@Z)

Error   19  error LNK1120: 2 unresolved externals

我相信错误的原因可以在 boost auto_link.hpp 文件的以下部分中看到:

#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500)

   // vc90:
#  define BOOST_LIB_TOOLSET "vc90"
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600)


// vc10:

#  define BOOST_LIB_TOOLSET "vc100"

这表明自动链接器仍在尝试链接到 v100 库,尽管 boost 库和项目文件被设置为 v90 工具集。我不知道 BOOST_MSVC 值是在哪里/如何定义的,但希望这是导致我的链接器错误的原因。

我的项目 build.h 文件包含以下语句:

#define BOOST_ALL_DYN_LINK

4

0 回答 0