We have a huge legacy C project which runs in VC++6. And I hope this will be ported to later versions of visual studio. But I think it will be a huge work. Actually, I just tried to recompile the project with VS2005 and got so many errors.

So, do you have any experience of this type of porting? Any recommendations?


Porting can be hard work and getting it to compile is only the first step. But getting it to compile is a big milestone and something to aim for. The problem with porting is that it can be very intimidating to look at a massive list of a 1000 errors (Visual Studio caps the errors in the error window). It seems hopeless.

The good news is that even though there are many changes between VC6 and later versions, Microsoft worked hard to maintain compatibility where ever possible and to provide simple workarounds for most of the incompatibilities. Take hope from this and forge ahead.

At first your goal is simply to get it to compile. Instead of focusing on a thousand or more errors, focus on one project that doesn't depend on any other projects (a leaf project) and disable all the others in the solution configuration or systematically use Build -> Project Only... -> Build. Now you have a lot fewer errors to contend with.

Next go to the output window instead of the error window and find the very first error. Forget about the other errors because when porting you get a cascading effect of many spurious errors. Just try to fix the first error.

How to fix the first error?

  • Look at the line of code reported by the error message
  • Fix it if it's an obvious problem
  • If not, MSDN, Google and Stack Overflow are your friends: search

Who knows maybe you fixed a hundred errors with that one change because it was in a header file that every file includes. Now you are making progress. Just chip away at the errors, always looking for the first error. Once the leaf project compiles, add more projects one by one until all of them build.

If you are lucky, you'll notice patterns. Once you've fixed something in one place, use Find in Solution to fix the similar cases. You'll probably find that you don't need to make as many changes as you thought and sometimes the number of errors will drop dramatically with a single change. This will boost your morale! But it can be unpredictable. You might think you are near the end and then a whole new rash of problems crop up because the compiler tries to suppress later errors based on previous ones.

Once it builds, then the debugging begins...

  • Very good point regarding header files: fix errors there first - and you're likely to get rid of numerous and mostly redundant error messages from all .cpp files that include those headers. – Andrew Андрей Листочкин Jul 7 '11 at 11:29

I don't know tons about visual studio but a search turned up this.

It looks like you mostly have to worry about scope, type, and scanf errors.


Get a new version of VS (2008 or 2010). VS2005 wasn't very comfortable to use.

If you are using a version control system (and I hope you do), make a branch for the migration to the newer VS.

As mentioned before start fixing the first error.

I migrated a big project from VC6 to VS2008 and most errors were something like winable.h has been replaced by winuser.h etc.

Be aware, if the project depends on third party DLLs compiled with VC6 you might run into some issues, e.g. the CString implementation has totally changed from VC6 to VS2005.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.