Marc.2377
Marc.2377

Reputation: 8734

Use of MSVC-compiled Boost binaries in a MinGW-compiled project

I've downloaded Boost Binaries from here. My project depends on boost_system and boost_filesystem, and builds correctly if I add the proper dependencies to Linker Options when using Visual Studio for compilation, but I'm now trying to compile under Code::Blocks (MinGW compiler) and running into the following:

"directve `/FAILIFMISMATCH:"_MSC_VER=1800" /FAILIFMISMATCH:"_ITERATOR_DEBUG_LEVEL=0" /FAILIFMISMATCH:"RuntimeLibrary=MD_DynamicRelease" /DEFAULTLIB:"msvcprt" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" "

Though that's a warning, it keeps me from finding the dependencies, because my project fails to build with undefined reference to 'boost::system::generic_category()' and plenty of other related undefined references.

Question: Should I compile Boost from source using MinGW, in order to solve my problem?

Of course, I'm using the proper libraries for my build configuration (Release, dynamic runtime library).

Upvotes: 0

Views: 621

Answers (1)

Marc.2377
Marc.2377

Reputation: 8734

I'm making an answser based on the comments posted below my question, just to make things proper.

So, building boost from the source code using the same compiler (I used TDM-GCC with gcc 4.8.1) did solve the linking issues.

As noted by Rup, one "can't mix C++ compiled with GCC and Visual Studio: they have different C++ ABI implementations, and generate different 'manglings' of identifier names so that linker symbols won't match up."

Additional reference: Interoperability of Libraries Created by Different Compiler Brands

Upvotes: 1

Related Questions