Linker problem linking boost in Visual Studio 2008

。_饼干妹妹 提交于 2019-12-11 15:45:28

问题


I have a rather obscure linking problem in Visual Studio 2008. The linker error message is: "LNK1104: cannot open file 'boost_thread-vc90-mt-gd-1_38.lib'". All pathes and dependencies are set. What I noticed though is that Visual Studio misses boost_thread-vc90-mt-gd-1_38.lib and not libboost_thread-vc90-mt-gd-1_38.lib (notice the lib at the beginning of the file name). I added the .lib as libboost_thread-vc90-mt-gd-1_38.lib to the project and it appears as libboost_thread-vc90-mt-gd-1_38.lib in the command line.

Why does Visual Studio the beginning of the file name?


回答1:


There is a rule for naming libraries in Boost:

1) boost_thread-vc90-mt-gd-1_38.lib for dynamically linked version 2) libboost_thread-vc90-mt-gd-1_38.lib for statically linked version

BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".

There is a preprocessor define that you can define in your project in order to use the dynamically linked version of a boost library BOOST_DYN_LINK=1

It has this description:

BOOST_DYN_LINK: Optional: when set link to dll rather than static library.

Another define that tells to use the dynamic version of Boost.Thread is BOOST_THREAD_USE_DLL



来源:https://stackoverflow.com/questions/2560983/linker-problem-linking-boost-in-visual-studio-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!