Question

I'm trying to link the shared library of boost thread into my application.

System: Windows8

IDE: Visual Studio 2010

I build the boost library using:

b2 --with-thread --build-type=complete link=shared

I can see the

boost_thread-vc100-mt-gd-1_55.dll
boost_thread-vc100-mt-gd-1_55.lib

and other file inside the stage/lib directory

I've added the path to Additional Library Directories and Input in linker option as:

Additional Library Directories: C:/boost_1_55_0_dyn/stage/lib

Input: C:\boost_1_55_0_dyn\stage\lib\boost_thread-vc100-mt-gd-1_55.lib

I don't know why on the earth Visual Studio is looking for libboost_thread-vc100-mt-gd-1_55.lib. I haven't mentioned the libboost_thread-vc100-mt-gd-1_55.lib anywhere in the properties or any place. I even search all my files and folders inside the project, libboost_thread-vc100-mt-gd-1_55.lib is not mentioned anywhere.

Was it helpful?

Solution

Well I forgot to put BOOST_ALL_DYN_LINK in preprocessor definition. If the BOOST_ALL_DYN_LINK is not defined, boost looks for static library, that is why its looking for libboost_thread-vc100-mt-gd-1_55.lib

OTHER TIPS

This is additional information to the answer Pritesh already posted, but I'm new here so I can't comment.

It boils down to compatibility between your VS project settings and the way the boost libraries were built. It gets a little tricky because boost and VS do some autolinking for you. Check out the file …\Include\boost\config\Auto_link.hpp. It explains the algorithms and macros that will cause libraries that you didn't explicitly include to show up in your project.

For example, BOOST_ALL_DYN_LINK is used to help determine if the boost library name should have "lib" pre-pended to the name during autolink.

Additionally ,

If you are using cmake and qibuild you can try this :

It automatically links with the corresponding libraries and make their headers available.

qi_use_lib(yourProgramName your libraries)

like this:

qi_use_lib(getimages ALCOMMON ALPROXIES ALVISION OPENCV2_CORE OPENCV2_HIGHGUI OPENCV2_IMGPROC)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top