2

I have a project which uses the MongoDB C++ driver. As I'm on WinXP I have to use MongoDB 2.0, which uses Boost 1.42. However my application uses Boost 1.48.

When I statically link the MongoDB driver and build my application I get a LNK1104 linker error that libboost_system-vc100-md-gd-1_42.lib is missing. When I add this library in addition to the in the app required 1.48 library version, I get a LNK2005 "boost::system::throws already defined" linker error.

Is there a way to use Boost 1.42 in my static library for MongoDB and use Boost 1.48 in my application?

TemplateRex
  • 69,038
  • 19
  • 164
  • 304
Simon
  • 1,616
  • 2
  • 17
  • 39
  • 1
    Possible duplicate of [Using concurrently 2 versions of boost](http://stackoverflow.com/questions/2907882/using-concurrently-2-versions-of-boost) – vitaut Mar 25 '16 at 23:15

1 Answers1

2

You could split your build process: first compile the MongDB C++ driver into a separate .lib while linking against Boost 1.42.0 Then in a second step you compile your own application, linking against the MongoDB library and Boost 1.48.0. This should work as long as the MongDB .lib does not expose any of the boost functions such as boost::system::throws. See this question for how to limit the public interface from exposing Boost symbols.

Alternatively, try compiling your entire application with only a single Boost version (either 1.42 or 1.48).

Community
  • 1
  • 1
TemplateRex
  • 69,038
  • 19
  • 164
  • 304