开发者

Missing A Detail About Boost (.lib files)

Where do I find the lib files for linking my program when using some Boost libraries? Decided to try its threading fun开发者_运维问答ctionality but I am getting

Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice

after I include

Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice

I can't find where to get the .lib files for proper linking on the boost website? Any tips? :)


Some of the Boost libraries need to be built (the ones that use OS-specific functions, for example). You can build them yourself, or download a pre-built package.


An alternative solution I use is to create your own wrapper project with the bits of boost that you are using. Generally in VS.Net this is just a matter of just adding the cpp files from the boost/libs/blah subdirectory. They compile very cleanly so you don't normally need to do any other setting up of your project. I find this technique to be useful if you are wanting to automate builds from SCM and you don't want to check in binaries. It's also very fast as you only build the bits you need. Another advantage is that it's easier to create configurations that are relevant to your projects, ie Debug/Release, static/dynamic, 32/64 bit. One gotcha though is that you need to disable the auto-linking option by defining BOOST_ALL_NO_LIB when you build your project.

Alternatively, you'll need to use the jam tool to build the raw libraries for the configurations you require.


.lib files are often nested under a folder called stage, so you may need to replace boost/lib with boost/stage/lib in the Additional Library Directories section under your project properties. Section 6 and 6.1 of this tutorial describe this process, but do not include Boost's stage folder.

You can also do a file search for the broken .lib file to get an idea of the location.


It all depends on which operating system / compiler you're using.

I suggest you download the boost source code and learn how to build Boost.


This problem is caused because Boost installation does not install threading libraries by default. You have to specifically select the threading libraries during installation. So, re-run the installation and select the threading library and select the version of your compiler to download appropriate files. In this case for file "'libboost_thread-vc90-mt-gd-1_42.lib" you need to select multi-threading for version VC++ compiler 9.0 debug with boost library version 1.42.

I hope this helps...


I hit the same link error using boost version 1.44 and the pre-built installer. I unzipped "libboost_data_time_vc100-mt-gd-144.zip" which contains only the missing .lib and this seems to have solved the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜