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 &ltbx
CString s;

This shows error, saying that AddString doesn't take argument of a type CString. The same goes for

CListBox &ltbx
std::string 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.

Need Your Help

Writing a unique identifier to script?

python file rewrite

I'd like to write a subscript that adds a unique identifier (machine time) to a script everytime that it runs. However, each time I edit the script (in IDLE) the indetifiers are over-written. Is th...

Max Conditional Statements in Excel with duplicate max values

excel conditional-statements

I need help in Excel of finding finding the Correct Output based on Amount of four conditional statements of: