Grub
Grub

Reputation: 883

Compiling c++ Visual C++ 7.1 solution without Visual C++

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

Upvotes: 2

Views: 795

Answers (3)

Steve Townsend
Steve Townsend

Reputation: 54178

You can get detailed information on the rationale for a compiler error by searching on the error code in MSDN, eg. C4430 happens when you have a function declared without an explicit return type. Visual C++ 6 assumed int here, later versions will fail to compile.

See here for details in MSDN - other error code searches (in this case it was for string C4430) will also work.

This error can be generated as a result of compiler conformance work that was done for Visual C++ 2005: all declarations must explicitly specify the type; int is no longer assumed.

Upvotes: 0

Roel
Roel

Reputation: 19642

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:

  • Go back to Visual Studio 2003. Easy.
  • Fix the code. C++ knowledge and/or many trips to this site required. Not so easy.

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).

Upvotes: 1

Peter
Peter

Reputation: 7335

The first error (function call missing argument list; use '&CServerSocket::SelfDestruct') is a change in compiler between VS2003 and VS2005 to be more compliant with the standard. As far as I know, the only solution here is to amend the code as the message suggests. We had several cases of this when we upgraded VS some years ago; it's not that hard to fix them.

I don't think you are going to be able to compile this under VS2010 without amending the code somehow. I would start fixing them one by one; it certainly seems like the other four errors are all linked together and if you figure out what's wrong there it may not require much of a change to fix. Posting the code that causes it would help the rest of us.

Upvotes: 3

Related Questions