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.
libboost_filesystem-vc110-mt-gd-1_51.lib
is a library that has been built with VS 2012 (Also known as VC 11.0), as indicated by the vc110
in the naming convention. This library will not link properly with objects built with VS 2010 (also known as VC 10.0).
If you want to build your program with VS 2010, you'll need to get or build boost libraries for VS 2010.