fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_51.lib'

Seem I can't get this to work. I made a simple console application (which depend on websocket++ library) which need Boost libraries.. but when I try to compile I get:

fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_51.lib'

However, I did the bjam which created the lib in (boost_root)/stage/libs and I linked the path to the libs to the compiler C++/Additionnals includes.

If I look in (boost_root)/stage/libs the file libboost_system-vc110-mt-gd-1_51.lib is not there. It is called libboost_system-vc110-mt-sgd-1_51.lib instead.

Any idea?


Solution 1:

This is the simplest way for an amateur like me who is studying C++ on their own:

First Unzip the boost library to any directory of your choice. I recommend c:\directory.

  1. Open your visual C++.
  2. Create a new project.
  3. Right click on the project.
  4. Click on property.
  5. Click on C/C++.
  6. Click on general.
  7. Select additional include library.
  8. Include the library destination. e.g. c:\boost_1_57_0.
  9. Click on pre-compiler header.
  10. Click on create/use pre-compiled header.
  11. Select not using pre-compiled header.

Then go over to the link library were you experienced your problems.

  1. Go to were the extracted file was c:\boost_1_57_0.
  2. Click on booststrap.bat (don't bother to type on the command window just wait and don't close the window that is the place I had my problem that took me two weeks to solve. After a while the booststrap will run and produce the same file, but now with two different names: b2, and bjam.
  3. Click on b2 and wait it to run.
  4. Click on bjam and wait it to run. Then a folder will be produce called stage.
  5. Right click on the project.
  6. Click on property.
  7. Click on linker.
  8. Click on general.
  9. Click on include additional library directory.
  10. Select the part of the library e.g. c:\boost_1_57_0\stage\lib.

And you are good to go!

Solution 2:

The C++ → General → Additional Include Directories parameter is for listing directories where the compiler will search for header files.

You need to tell the linker where to look for libraries to link to. To access this setting, right-click on the project name in the Solution Explorer window, then Properties → Linker → General → Additional Library Directories. Enter <boost_path>\stage\lib here (this is the path where the libraries are located if you build Boost using default options).