Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_43.lib'

Made a new project, added main.cpp and wrote the code at this URL:

http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp

Also, added the appropriate include path.

What's next?!?!! It seems like a darn mystery to build a boost code!

Been digging on it for more than 10 hours.

Can anyone give a straightforward answer on how to build the boost library from the code under windows, VC9?

like image 844
Poni Avatar asked May 22 '10 19:05

Poni


4 Answers

You need to use bjam. It is responsible for creating the libraries that your application will use. Once you use bjam, you are going to need to instruct your project to include the lib file. You do this by going into the project's properties -> Configuration Properties -> Linker -> General. Add the directory which created the lib file to Additional Library Directories. You should be capable of correctly linking after that. I believe that this link describes the steps better than I could attempt in a post

like image 57
bogertron Avatar answered Nov 05 '22 05:11

bogertron


@bogertron: I want to hug you! (:

So, at last, with a real head ache, I've managed to do so.

The exact steps I took, so others will be saved from the head ache:

  1. Went to http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source .

  2. Followed the "5.3.1 Get bjam" clause. Downloaded the "pre-built bjam executable for your platform" at this URL: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 .

  3. Extracted the ZIP file (my platform is Windows).

  4. Ran "build.bat". It produced the file "bin.ntx86/bjam.exe".

  5. Copied this file to my PATH ("...../boost_1_43_0/").

  6. From a command line, executed "bjam.exe" and waited for about 4-5 minutes.

Then got this message at the console: "The Boost C++ Libraries were successfully built!"

That's it, it even tells you where the include & lib files are.

like image 22
Poni Avatar answered Nov 05 '22 07:11

Poni


Not all Boost libraries are header only, Boost.System is one of them. The documentation for Boost.Asio tells you that it depends on Boost.System.

With Visual Studio, the Boost libraries use auto-linking, which means you don't have to explicitly link to the libraries you need. You however need to have the necessary libraries in the library search path, either globally or per-project.

If you don't want to build the Boost libraries yourself, you can use the installers provided by boostpro (only up to Boost 1.42 though at the moment). If you want to build them yourself instead, the documentation covers that well.

like image 9
Georg Fritzsche Avatar answered Nov 05 '22 05:11

Georg Fritzsche


I had the same error and i followed the SourceForge. The link will take you to a folder of zipped lib and dll files for version of boost.You can download and unzip related library and when copied it to the related location everything gonna be alright ;)

like image 1
Cracker Avatar answered Nov 05 '22 06:11

Cracker