Boost logo

Boost :

Subject: [boost] Boost Threads - x86 Platforms / 64 bits compilation in Managed/Unmanaged Code / Visual Studio 2010 / Windows SDK 7.1 /clr
From: Guillaume Rembert (grembert_at_[hidden])
Date: 2012-05-07 07:28:05


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 (mix
of lots of the different specific posts). I could not find an easy, up
to date procedure for this.

This has been tested with Boost 1_49_0 release, Visual Studio 2010,
Windows SDK 7.1 and Microsoft .NET 4.

- Download 64 bits libraries, as binaries: http://boost.teeks99.com/ +
unzip in a dedicated folder (for the example C:\boost\lib64)
- Download boost headers and source code:
http://sourceforge.net/projects/boost/files/boost/1.49.0/ + unzip in a
dedicate folder (for the example C:\boost)
- Set the project not to use precompiled headers + compilation with /clr
to mix managed and unmanaged code
- Add the headers path to the project additional include directories (in
the example C:\boost)
- Add the compiled libraries path to the linker additional library
directories (in the example C:\boost\lib64)
- Add to your project the following lines (force dynamic linking):
#define BOOST_ALL_DYN_LINK
#define BOOST_THREAD_USE_DLL
#define BOOST_LIB_DIAGNOSTIC
#include <boost/thread.hpp>

--> Just compile and execute, it should not give any problems.

The first line (#define BOOST_ALL_DYN_LINK) solves the following error I
had:

An unhandled exception of type 'System.TypeInitializationException'
occurred in Unknown Module.

Additional information: The type initializer for '<Module>' threw an
exception.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk