[Liblas-devel] VS2010 LNK2005 error between msvcprtd.lib and libboost

Werner Goeman wgoeman at telin.ugent.be
Wed Mar 28 07:49:36 EDT 2012


Setup: VS2010 – Cmake 2.8.7 – libLAS1.7.0

This is about a LNK2005 error between msvcprtd.lib and 
libboost_program_options-vc100-mt-sgd-1_47.lib

I follow the documentation as close as possible. I didn’t add optional 
libraries, only boost was installed (succesfully). CMake runs good, I 
think, but selects the static lib which are mutlithread NOT debug mode. 
I fixed this by manually changing the libs in CMake GUI. The solution 
for VS was then created.

When I try to build in VS2010, I get the same type of error all over:

File msvcprtd.lib(MSVCP100D.dll):

error LNK2005: "public: struct std::_Iterator_base12 * * __thiscall 
std::_Container_base12::_Getpfirst(void)const " 
(?_Getpfirst at _Container_base12@std@@QBEPAPAU_Iterator_base12 at 2@XZ) 
already defined in 
libboost_program_options-vc100-mt-sgd-1_47.lib(parsers.obj)            
C:\Dev\libLAS\libLAS-1.7.0\src\msvcprtd.lib(MSVCP100D.dll)

It looks to me that I need to link against the dynamic libraries of 
boost, but when I try that, VS always tries to find the wrong libs even 
after I manually changed the filenames to link against in CMake and/or 
the project settings itself in VS. The thing there is that the cmake 
construct expects the library names to begin with “libboost” which is 
the case for static libs, but for dynamic ones it is just “boost”. When 
trying to build, it seems that the libboost files are still linked 
against even if they are NOT mentioned in the project settings. But in 
the end, I don’t know if that willl solve my LNK2005 problem above…

Can someone give a clue what is happening here?

Thank you!
Werner


More information about the Liblas-devel mailing list