views:

520

answers:

7

Is there anything I should know before converting a large C++ program from VS2005 to VS2008?

A: 

Is there a difference in the syntax that you can't just simply recompile? VS will convert the .sln and vcproj files for you automatically. The rest is just code, and unless you are doing something really strange, it should just recompile as-is.

Jim Buck
And is my answer is bad... how? It's basically the same as half the other answers.
Jim Buck
+2  A: 

At my work we converted a large C++ project from VS2005 to VS2008. There were no issues at all. Needless to say, you should definitely still keep a copy of the old project just in case. :)

Edit: I should have mentioned that the project is meant to be platform-independent, and has no gui components.

Dima
A: 

I recently converted a project written using VC++5, which I hadn't touched in 10 years to VS2008. I just loaded the project and let VS2008 convert it. Everything went fine. (project now here: http://www.codeplex.com/Uptime)

James Curran
+1  A: 

If your project is using MFC then you should be aware that it's had a fairly major update in 2008 which could break things. Mostly security and UI updates, so worth doing anyway in my opinion.

See here for more general information on what's changed in VS 2008.

Stu Mackellar
+6  A: 

I'm working on this very problem right now.

Running WinMerge to see what I've changed...

OK, here is what I had to fix in an huge Win32/MFC client application:

Some MFC functions have become virtual (which were not in the past - CWnd::GetMenu for one, if I recall correctly). Also something related to our legacy mouse wheel support (before Windows had built-in mouse wheel support) somehow broke (I just removed the feature, so I never really figured out why that broke).

Some ATL methods (or method params) have changed to const that were not originally (screwed up my overrides).

The Platform SDK is newer - be careful if you're setting the windows SDK version #defines correctly (we were not in all places - which was dumb). You may now be building with newer versions (Vista/2008) of Win32 structures. This didn't work so great on my XP box.

STDMETHOD now includes __declspec(nothrow) which is 100% right - except this found some problems in our code. Some interface that was written like it would be exposed through COM, but never was, threw exceptions.

The IDE has a bug where disabled breakpoints don't show the hollow circle in the margin if you don't have the break points set to highlight the whole line (which I think is the default for VC++, maybe?).

Most of these issues were due to subtle mistakes in our code or aggressive overloading of MFC/ATL libraries. Since everyone else's code is perfect, you should be fine ;)

Aardvark
A: 

In our experience, the projects convert just fine. The only code change we encountered was where _MIN and _MAX were removed - we had to change it to std::min(), etc. Our MFC stuff compiled OK. Our biggest headache was getting VS 2008 versions of third party libraries we bought, and building VS 2008 versions of large open source packages like boost, OpenSceneGraph, and GDAL. Not rocket science - just kind of tedious. I wrote a short synopsis on my blog.

Brian Stewart
+1  A: 

If you have to support older platforms, beware: VC2008 is the first version that can't target Win9x or NT4. My company has to stick to VC2005 for that very reason.

Head Geek