Subject: [Boost-build] Boost thread gcc/msvc, library linking depending on OS
From: Christian Auby (christian_at_[hidden])
Date: 2009-09-29 04:04:33
1. I have a jamfile with "requirements <threading>multi" in project, and
/boost//thread in the lib that uses boost thread. I have to require the
lib directly as gcc doesn't do auto-linking. Now, this builds on both
gcc and msvc, but with msvc I get this warning:
library\library.cpp(1) : warning C4005: 'BOOST_THREAD_USE_LIB' : macro
see previous definition of 'BOOST_THREAD_USE_LIB'
It happens for every file in that lib. GCC compiles without warnings.
Why does this happen and how do I prevent it? If I remove
"/boost//thread" it compiles without warnings on msvc but then it won't
compile on gcc so that's not a good workaround for me.
2. Since my jamfile must support both msvc and gcc I have to
explicatively link libraries. One such library is libws2_32 (winsock 2).
How do I link this only when compiling on Windows? I use a third party
lib that requires ws2 on windows.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk