
On 05/07/2012 01:28 PM, Guillaume Rembert wrote:
As I had lots of issues to include boost thread libraries in a windows 64 bits code generated under Visual Studio 2010, here are the different steps to follow in order to get it compiling and executing quickly. [...]
Let me point out those are fairly normal steps to get any C++ library to work with any C++ compiler. There is nothing special here.
- Add to your project the following lines (force dynamic linking): #define BOOST_ALL_DYN_LINK
This sets all Boost libraries to use their dynamic variant. Indeed, the headers need to know whether you want to link against the static or dynamic variant of the libraries (especially on Windows, on most other platforms this doesn't really matter).
#define BOOST_THREAD_USE_DLL
This sets Boost.Thread to use its dynamic variant. There is also BOOST_THREAD_DYN_LINK that does essentially the same thing. I don't know why Boost.Thread has two of them, probably historical reasons. Note BOOST_ALL_DYN_LINK does imply BOOST_THREAD_DYN_LINK.
#define BOOST_LIB_DIAGNOSTIC
This is an option to debug your setup, and is not necessary.
#include<boost/thread.hpp>
You should probably define those flags on the command line, not before including <boost/thread.hpp>.