• 14
• 12
• 9
• 10
• 13

# Trouble getting boost library

This topic is 1824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello.

I am currently trying to build my own boost library for VS2012 and i just struggle to find a tutorial or just way its done.

I found how its don't on 2010,2011, but i just cant get it to build.

Anyone knows a page where its explained how to get boost running for VS 2012? how to build it, is what i need. I don't think i will have trouble using it.

Edited by BaneTrapper

##### Share on other sites
When installing MSVC there will generally be something like "Visual Studio XXXX Command Prompt" in your start menu. Use it, unlike a normal shell it will have the MSVC executables in the path and probably include several environment variables not normally set. Boost will use them to detect the compiler.
Navigate to the directory where you have unpacked Boost. Call bootstrap to build bjam. Then actually compile boost. How you actually do that is a question of what exactly you need, one of my lines is
bjam --stagedir=. --build-dir=./build-dir variant=release,debug threading=multi link=static runtime-link=static,shared --toolset=msvc stage
But that's basically just following what is already described on the Boost page on how to build it.

##### Share on other sites

When installing MSVC there will generally be something like "Visual Studio XXXX Command Prompt" in your start menu. Use it, unlike a normal shell it will have the MSVC executables in the path and probably include several environment variables not normally set. Boost will use them to detect the compiler.
Navigate to the directory where you have unpacked Boost. Call bootstrap to build bjam. Then actually compile boost. How you actually do that is a question of what exactly you need, one of my lines is

bjam --stagedir=. --build-dir=./build-dir variant=release,debug threading=multi link=static runtime-link=static,shared --toolset=msvc stage
But that's basically just following what is already described on the Boost page on how to build it or what each setting means so i could build appropriately for me it.

I couldn't find how to build it on their home page. If you could refer me what each setting means so i could build appropriately for me it.

What i need is dynamic debug and release. for other settings i am unfamiliar what is their purpose.

Or is boost only static so i cant build dynamically?

Its building will see if its of any use

Edited by BaneTrapper

##### Share on other sites
I highly doubt you want dynamic debug and release. You probably want a debug and release build using the dynamic runtime, not having a DLL for each of Boost's sublibraries. In this case the line you probably want is
bjam --stagedir=. --build-dir=./build-dir variant=release,debug threading=multi link=static runtime-link=shared --toolset=msvc stage
which will have to do a bit less work compared to the above line.

Edit: For the record, the official build tutorial is here while an explanation of the parameters is here.

##### Share on other sites
Personally, I don't bother building boost separately. For the libraries that aren't header only I just add the relevant source files from libs/<whatever>/src to my project. This requires uncommenting the #define BOOST_ALL_NO_LIB line in boost/config/user.hpp or adding the equivalent line for the specific library like python or filesystem. For completeness for some libraries you can also get a preprocessor definition to disable dllexport on functions, but this isn't necessary for compilation.

##### Share on other sites

I highly doubt you want dynamic debug and release. You probably want a debug and release build using the dynamic runtime, not having a DLL for each of Boost's sublibraries. In this case the line you probably want is

bjam --stagedir=. --build-dir=./build-dir variant=release,debug threading=multi link=static runtime-link=shared --toolset=msvc stage
which will have to do a bit less work compared to the above line.

Edit: For the record, the official build tutorial is here while an explanation of the parameters is here.

I will try that out thanks.

My build problem. I tried to include #include <boost\filesystem.hpp> this is output

1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>  main.cpp
1>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc110-mt-gd-1_53.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

EDIT::
What i asked how to copy files around at this post. http://www.gamedev.net/topic/640771-coping-files-around-help/

I only need boost::filesystem part. Its cross platform so i decided to use it.

I currently have .dll files from other libs i am using so it wouldn't be problem including those i need in as well.

I just don't want issues for people if they will want to play the game i am making as(downloading and installing components because game wont run) i try to provide everything. Here starts the problem, i don't know what are advantages and disadvantages of static or dynamic libs or with sould i use in this case.

If you wanna help guide me id be much . Else i will just do with what i have.

Edited by BaneTrapper

##### Share on other sites
Either you have not compiled Boost properly for the configuration you are using or the Boost libraries are not in your library search path.

##### Share on other sites

Either you have not compiled Boost properly for the configuration you are using or the Boost libraries are not in your library search path.

I got it working.

Thanks on the build settings it works. Guessing link had to be static not shared.