Project compiles in only in a certain version of Visual Studio
I have a project that uses MFC and standard C++. I dont know in which VS it was originally made. When opened on the machine with only VS2012 installed and on the machine with only VS2010 installed - it doesn't build, showing errors, mostly regarding type mismatch. For example:
CListBox <bx CString s; ltbx.AddString(s);
This shows error, saying that AddString doesn't take argument of a type CString. The same goes for
CListBox <bx std::string str; ltbx.AddString(str.c_str());
This code as well shows an error:
string str; CString CInputID; str = static_cast<string> (CInputID);
It says that there is no user defined conversion from CString to std::string.
No doubt, I should be using different types for strings and all, but the exact same project opened on the machine which has installed both VS2010 and VS2008 works just fine, all types are matched. So my question is how does this work? I am thinking, maybe VS2008 has some libraries that define all necessary conversions and VS2010 is just making use of them. If so, what are those libraries and how can i make this project work on machines with no 2008 studio installed?
AddString takes a LPCTSTR which is a const char* or const wchar_t* depending on whether _UNICODE is defined.
The difference is probably that _UNICODE is defined in your VS2012 project.