Skip to content
Advertisement

Can boost lib built on windows with msvc be used in a linux program

I built boost from source on windows. I can compile with it on windows.

When I want to compile with it in linux :

Unable to find the requested Boost libraries.

Boost version: 1.65.1

Boost include path: pathtoproject/deps/boost

Could not find the following Boost libraries:

      boost_system

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.

So I set findboost debug flag to understand why using

 set(Boost_DEBUG 1)

in CMake. I get :

Boost_FOUND = 1

But also

Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc54-mt-1_65_1;boost_system-gcc54-mt;boost_system-mt-1_65_1;boost_system-mt;boost_system

Which means cmake is looking for libs named “gcc54“.

But my libs are named “vc141” (msvc).

So can it works or do I need 2 boost builds for it to work on both systems.

Advertisement

Answer

You generally can’t mix and match between compilers, unless it is explicitly supported. In this case, it is very much not supported.

Advertisement