C++/Problem upgrading to MS VC++8 Express Edition
Expert: Ralph McArdell - 3/20/2008
QuestionHi Ralph,
As per your suggestion, I've upgraded from VC++6 and downloaded MS VisualC++8, but have a problem.
Initially I tried to build one of my old programs with VC++8 but the build failed because of a missing file: afxwin.h.
I then found and went to 'File | New | Project from existing code' and tried to build the project but again had a failure do to the missing afxwin.h.
Rebuilding this program from scratch will be very time consuming as it is a huge program.
What do you suggest I do?
Thank you,
-Neil
AnswerFirstly if you are the Neil who asked about localising displayed number formats then as far as I can see I did not advise you to upgrade to MSVC++ 2005 or later compiler . I mentioned in that answer that I had not used C++ standard library locales with MSVC++ 6.0 and that I had tried the presented code fragments using MSVC++ 8.0 (a.k.a 2005). However I do not see anywhere where I explicitly suggest that you upgrade to MSVC++ 8.0 or later. (Note: if you are some other questioner, or you are taking advice from another question then I am sorry but I do not know which answer you are referring to and thus I am unsure what exactly I advised).
I do not in general advise MSVC++ 6.0 users to upgrade because I know that many people are stuck using large MSVC++ 6.0 codebases, that MSVC++ 6.0 has an old but adequate standard library implementation (and upgrades from Dinkumware are - or were - available) and that your question suggested you were doing more than just course assignments.
I do from time to time suggest people consider updating their compiler. This tends to be when I suspect (or know) they are using a really ancient compiler that pre-dates the ISO C++ standard and has no standard C++ library implementation (for some reason Turbo C++ 3.0 released around 1991 is still quite popular in some places). Even then I am aware that doing so may not be a feasible option in all cases, hence I merely suggest they consider such a change.
When changing the tools used in any non-trivial project you have to plan the changes, maybe treating it like a mini-port to a new platform. I know one company that took weeks (maybe months) to make their MSVC++ 6.0 codebase MSVC++ 7.1 (.NET 2003) compliant. Only once those involved with the update 'porting' work had finished were other MS Windows developers and main stream development moved from MSVC++ 6.0 to 7.1.
However your immediate problem in this case is probably somewhat more fundamental. The free express edition of Microsoft Visual C++ 2005 (and the new 2008 version) does not include the Microsoft specific libraries - MFC and ATL. Nor does it include the (full) platform SDK which has to be downloaded and installed separately (this may have changed for the new 2008 edition). To get access to MFC, ATL, 64-bit compilers etc. you have to buy licences for higher end versions of Visual C++.
The other reason (i.e. you are not using the free express edition) could be that the include paths are not set up correctly - check out the global options dialog menu option (Tools -> Options), under the Projects and Solutions -> VC++ Directories section. Whilst checking the include files paths check out the library files paths as well.
For a comparison of Visual C++ 2005 features see the table in the MSDN library article "Visual C++ Editions" at:
http://msdn2.microsoft.com/en-us/library/hs24szh9(VS.80).aspx
For the equivalent table for the new Visual C++ 2008 editions see:
http://msdn2.microsoft.com/en-us/library/hs24szh9.aspx
You will also notice that the express editions lack a resource editor, which makes GUI work tedious to say the least.
Note that if you obtain (or are thinking of obtaining) one of the other Microsoft Visual C++ 2005 (or 2008) editions then you should read carefully the information on changes and upgrading. You might like to start with the sections under:
Development Tool and Languages > Visual Studio > Visual C++ > Getting Started > Previous Product Changes
Development Tool and Languages > Visual Studio > Visual C++ > Porting and Upgrading
or similar paths in the MSDN library documentation (the above documentation paths are taken from my somewhat out of date local MSDN library installation).
The online MSDN references (for MSVC++ 2005) are:
http://msdn2.microsoft.com/en-us/library/686cfhy4(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/7hfabkez(VS.80).aspx
The other obvious class of problem you may very well run into is core C++ language implementation differences. Microsoft has been improving their compilers and so bad code that might previously have compiled may not do so anymore. Also of course good code that previously compiled may not do so if you happen to bump into a compiler bug!
As to re-building the whole application. Well you would have to do that to compile and link everything using the new tools etc. You should _not_ have to re-write the whole application however, only update those parts that need it. That is re-building means compile and link everything in full, often this is the same as a clean (of all targets and intermediate files) followed by a build.
Note: MSDN online references correct at time of writing as far as I know but may change over time.
Hope this helps - even if it not really what you wanted to know - sorry.