Compiling Bullet physics and Boost together as static librar

Post Reply
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Compiling Bullet physics and Boost together as static librar

Post by dumbo2007 »

I develop addons for a space flight simulator called Orbiter: http://orbit.medphys.ucl.ac.uk/

It accepts plugins as dll files. I recently made a plugin which uses the Bullet physics library as well. Its statically linked to the dll, so the bullet library is itself not a dll but compiled right into the plugin. Bullet is compiled with Multi-threaded (/MT) option for the release and Multi-threaded Debug (/MTd) for debug

Now I want to use threads from Boost. So I installed the static Boost libraries by choosing the 2 static options from the Boost Pro installer. I was able to successfully create a Win 32 application with these static libraries. The application used Multi-threaded (/MT) as well. So I know that there is no mismatch on the flags.

Yet, when I add Boost to my Orbiter dll plugin project, which also has Bullet, I get a link error :

1>------ Build started: Project: Bump, Configuration: Release Win32 ------

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(F:\Orbiter\Orbitersdk\samples\BumpThreaded\Release\Bump.dll) does not match the Linker's OutputFile property value (F:\Orbiter\Modules\Plugin\Bump.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).

1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)

1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) 1> Creating library F:\Orbiter\Orbitersdk\samples\BumpThreaded\Release\Bump.lib and object F:\Orbiter\Orbitersdk\samples\BumpThreaded\Release\Bump.exp

1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>......\Modules\Plugin\Bump.dll : fatal error LNK1169: one or more multiply defined symbols found

========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

From what I read on other questions, this can be due to mismatched flags for 2 libraries being used within an application. But thats not the case here. Both Bullet and Boost are compiled with /MT.

Also boost works ok with a normal win 32 application, so why the problem when linking it statically to output a dll ?

I use visual studio 2010 express and have a windows 7 64 bit system.

Thanks for any help in advance :)


Here is the stackoverflow counterpart too : http://stackoverflow.com/questions/1036 ... -libraries
Post Reply