|
Boost : |
From: David Barrett (dbarrett_at_[hidden])
Date: 2004-08-22 15:12:43
Hi, I see a lot of people have been having problems statically-linking
Boost.Threads with Visual Studio .NET 2003. For what it's worth, I just got
it to work, and here's what I did:
1) Created and entered a C:\Libraries folder
C:\> Mkdir c:\Libraries
C:\> cd c:\Libraries
2) Checked out the latest code from CVS using:
(From http://boost.org/more/getting_started.html)
cvs -d:pserver:anonymous_at_[hidden]:/cvsroot/boost login
[Hit <return> when it asks for a password]
cvs -z3 -d:pserver:anonymous_at_[hidden]:/cvsroot/boost
checkout boost
cvs -d:pserver:anonymous_at_[hidden]:/cvsroot/boost logout
3) Installed Boost.Build and Boost.Jam
4) Built everything:
C:\Libraries\Boost> bjam --prefix=c:\Libraries\Boost install
5) Launched Visual Studio .NET 2003
6) Created a new Win32 Console Project (CTRL+SHIFT+N) and accompanying
solution named BoostTest
7) Configured the wizard to create an Empty Project (click "Application
Settings", check "Empty Project", click "Finish")
8) Configured the project to use the "Multi-threaded Debug Runtime Library"
(Project::BootTest Properties, C/C++::Code Generation::Runtime Library)
9) Configured the project to search for the Boost include files
(Project::BootTest Properties, C/C++::General::Additional Include
Directories) by adding:
C:\Libraries\boost\include
10) Created a new file named BoostTest.cpp (CTRL+SHIFT+A, click "C++ File",
type "BoostTest.cpp" in the Name field, click Open)
11) Inserted the single include line:
#include <boost/thread/thread.hpp>
12) Compiled (CTRL+F7)
13) It works!
So yes, that all seems pretty obvious. But it took me a long time to get
working. I was unable to get anything with a Boost.Thread header to compile
*at all* (with any combination of static/dynamic runtimes, #defines, and
code hacks) using the 1.31.0 release currently available for download via
SourceForge. But it works now, and I'm proof that it can be done. Good
luck!
-david
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk