I need to build a visual c++ solution (.dsp VC++ 7.1) which was written by someone else back in 2005. I’m attempting to compile the solution in VS2010 trial but it is giving me some errors as outlined below:
error C3867: 'CServerSocket::SelfDestruct': function call missing argument list; use '&CServerSocket::SelfDestruct' to create a pointer to member
error C2039: 'iterator_category' : is not a member of 'CommandDispatchInserter' c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C2146: syntax error : missing ';' before identifier 'iterator_category' c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 10.0\vc\include\xutility
error C2602: 'std::iterator_traits<_Iter>::iterator_category' is not a member of a base class of 'std::iterator_traits<_Iter>' c:\program files\microsoft visual studio 10.0\vc\include\xutility
It seems from my investigations that from VS2005 onwards there are different implementations of various libraries which are causing the errors, I think the code is fairly non compliant with standards which is also a factor. Instead of amending the code to fit in with VS’s requirement (which I’m fairly clueless about doing) I was wondering if there was a way of compiling this i nit’s current state, short of installing an instance of VS2003. I have tried using minGW for windows but had no luck. It didn’t seem to like the MFC libraries. Does anyone have any suggestions as to the most productive route to take?
Thanks in advance
For the first issue, use the & to explicitly take a pointer to member. There is no other way to get this to compile with VS9 or 10. This is a mechanical thing that is easy to add, very little C++ knowledge needed.
The second issue is, I think, that you’re missing a ‘typename’ qualifier somewhere. This is harder, if you don’t know C++ there is only little you can do. Fix the & issue first and post compiler logs and code for better answers.
As to your actual question, no there is no way to get this to compile with newer versions of VS; there are some ‘backwards compatibility’ compiler settings but these issues aren’t covered by it. Nor can you compile MFC code with any compiler other than the Visual Studio one, so the MingW route is useless to spend more time on.
So, your options are:
BTW, .dsp is not Visual Studio 7.1, it’s Visual Studio 6. If so, you’re screwed even more, because the changes since then are a lot bigger than since 7.1 (2003).