Can not compile Boost libraries with /MT :(

May 24, 2012 at 8:02pm
So I've compiled boost with this command:
bjam toolset=msvc-10.0 variant=debug,release threading=multi link=static

And it works fine with /MD but when I change it to /MT I get this error:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-sgd-1_49.lib'

I've searched through my boost folder and I just plain don't have this file...
Did I compile in an incorrect mode?
Help would be greatly appreciated.
May 24, 2012 at 8:37pm
Perhaps it's easier to just use the boost library installers for Visual Studio, available for free at http://www.boostpro.com/download/
Last edited on May 24, 2012 at 8:37pm
May 24, 2012 at 9:05pm
Try this:
The option “--build-type=complete” causes Boost.Build to build all supported variants of the libraries.
May 25, 2012 at 5:05am
I've tried to recompile with build tyle as complete like how coder777 said,
but now I get an error saying:
1
2
3
4
5
6
7
8
9
10
1
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Blake\Documents\Visual Studio 2010\Projects\NewTestImport\Debug\NewTestImport.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Is there a list of excludes I need to define?
Gah, I hate how libraries differ just based on threading...
May 25, 2012 at 5:41am
do you set /MT in the debug mode? Don't do that. Use /MTd for debug
May 25, 2012 at 6:26am
All I have to say is...wow.
Haha, thank you so very much coder777!

I am very much happy I have a working environment now :)
but it still irks me that I know so little about how libraries and threading modes affect each other. I've tried to Google the subject I keep getting unrelated things. Would you recommend a certain website page or even a book? I feel as though knowing this topic is very crucial.
May 25, 2012 at 7:24am
The msdn site would be a source:

http://msdn.microsoft.com/en-us/library/2kzt1wy3%28v=vs.71%29.aspx

Basically there two options: multi threaded with or without linking to DLL

Also there's a debug and a release variant.


You just must not mix this linkage models in any of the used components (libraries). Otherwise you're in trouble
May 25, 2012 at 4:01pm
@Yarlini

Download the latest version of boost libraries.
Navigate to the Visual Studio command prompt (I found mine in programs tab).
Set the directory to your boost library extracted folder.

Then type in this:
bjam toolset=msvc-10.0 --build-type=complete

Once its done add the base folder to the includes, and stage/lib to the libraries.
Also, this is important, go to Project Properties->C++->General
and add your base extracted boost folder to the "Additional Include Directories".

Now you can use both /MDd and /MTd. (not /MT)

Hope this helps!
and thanks coder777 for all the help!
Last edited on May 25, 2012 at 4:02pm
Topic archived. No new replies allowed.