I'm new to C++ and Boost. I'm doing a small simple program to trying to learn the Boost Filesystem library. I have followed the directions to build the Boost libs. And now when I try to compile this simple code I get 6 of these errors.
Error 5 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1600' in App.obj C:\SOURCE\ConsoleApp2\ConsoleApp2\libboost_filesystem-vc110-mt-gd-1_51.lib(codecvt_error_category.obj) ConsoleApp2 Error 1 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1600' in App.obj C:\SOURCE\ConsoleApp2\ConsoleApp2\libboost_filesystem-vc110-mt-gd-1_51.lib(operations.obj) ConsoleApp2 Error 2 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1600' in App.obj C:\SOURCE\ConsoleApp2\ConsoleApp2\libboost_filesystem-vc110-mt-gd-1_51.lib(path.obj) ConsoleApp2 Error 3 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1600' in App.obj C:\SOURCE\ConsoleApp2\ConsoleApp2\libboost_filesystem-vc110-mt-gd-1_51.lib(path_traits.obj) ConsoleApp2 Error 4 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1600' in App.obj C:\SOURCE\ConsoleApp2\ConsoleApp2\libboost_filesystem-vc110-mt-gd-1_51.lib(windows_file_codecvt.obj) ConsoleApp2 Error 6 error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-gd-1_51.lib' C:\SOURCE\ConsoleApp2\ConsoleApp2\LINK ConsoleApp2
My code in App.cpp
in my ConsoleApp2 project
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
int main(void)
{
path p = "C:\\TestFiles";
cout << is_directory(p);
return 0;
}
I'm trying to compile the app with Visual Studio 2010. Some of the info I have found online were related to VS 2012. This I don't think applies to me. I'd like to try to solve the 5 mismatch errors and the final link error. I'm hoping the last error is related to the 5 before it.
toolset
option to10.0
. Since it is compiled with VS 2012, it takes11.0
by default. This forces the libs to be used with VS 2012 alone. This is out of my experience. If you wish to use it with VS 2010, specify the toolset option to 10.0 and the libraries will be correctly built. – Mahesh