0
votes

I compiled and ran bjam and even b2.exe with the following command:

bjam --with-system --with-thread ..etc

I got my library files as:

libboost_system-vc110-mt-1_53.lib
libboost_system-vc110-mt-gd-1_53.lib

The problem is that, once I stated the directory and linked them in my project it keeps saying Version Mismatch: found /MDRelease in project /MTRelease.

Yes my project is statically linked for /MT release and that's what I need but boost is causing me trouble. Any ideas? Thank you.

2

2 Answers

1
votes

This sounds like a version problem. The error that you are getting indicates that some components were built with one set of libraries, and other components were built with a different set of libraries.

If you are building other components that uses this code with a different type of library, for example MT (multi-threaded - no debug), or MDd (multi-threaded debug for a dll) then you might get this error. You could also get this error if you are linking with the wrong set of libraries for Boost. You need to build with the same type of libraries that you are using in your own code. If you are using MTD, then build with the MTD version of Boost libraries as well.

To see what libraries your project(s) are using, right click on the project in the Solution Explorer Window and select properties. Properties can also be selected from the project menu, but make sure that you have a file in that project as the current file open in the editing window before doing this. Under Runtime Library you will see the type of library that you are using. If the project type is a dll, then this value should really be set to MDd. To see what type of project it is, click the Linker (or Librarian) option under properties and if the output file is dll, then the project type is dll. If it says library or exe, then the project is library or exe respectively. All of your projects of a given type should be built the same way. You should not try to mix and match release and debug versions for example. If you have an exe that you are building, then use whatever library that was used to build the library type of projects. To set the library, under properties select Configuration Properties / C/C++ / Code Generation / Runtime Library and choose a type from the dropdown box.

If the configuration looks correct for all projects, then try rebuilding from scratch. This can be done by right clicking on the project and selecting clean, followed by selecting rebuild.

When running b2.exe to build the libs, I always use the -q option to make it stop if it encounters an error. If there are errors in the build, they can sometimes be difficult to see since there is quite a bit of output from b2. For a list of options associated with b2, see this link.

Note also that the file libboost_system-vc110-mt-1_53.lib can only be used for VS 2012 projects. If you are not using VS 2012, then you need to do two things. First, you might not be able to use boost version 1.53 or higher with any version of Visual Studio prior to 2012 since 2012 is the first version that best supports the latest version of the C++ standard. So, you would probably have to use 1.52 instead. The second thing you would have to do is specify in b2 the version of Visual Studio that you are using with the toolset option (for example - --toolset=msvc-10.0 - if using VS 2010) so that it will build the correct libraries for you.

0
votes

You need to build static libs. This will do the trick:

bjam --build-type=complete