Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_55.lib'

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.

like image 457
Pritesh Acharya Avatar asked Mar 18 '14 08:03

Pritesh Acharya


2 Answers

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

like image 141
Pritesh Acharya Avatar answered Sep 30 '22 13:09

Pritesh Acharya


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.

like image 30
Tim Avatar answered Sep 30 '22 13:09

Tim