Migrating from MSVC 6.0 to Studio 2005?
greywar asks: "While the preferred method would be simply use Linux, unfortunately my company is using Microsoft Visual Studio 6.0 with C++. I have been asked to recomend if we should upgrade to the new upcoming visual studio 2005. Has anyone got any real life experience with moving a project of about 220,000 lines of code, 60,000 lines of comments from the old MSVC to the new Studio 2005 which is currently in Beta? What benefits are there, and what things do we lose? What problems will occur?"
I'm pretty sure your 60,000 lines of comments will port to the new environment okay. (But I actually have an example of where they didn't.)
real life experience?
Nope, only work related experience.
Sorry I couldn't help.
Love Microsoft or hate Microsoft ... their IDE has evolved incredibly well. I haven't tried Visual Studio 2005 yet, but 2003 is really well done for Windows development. I think minimally you'd see a productivity boost from that alone.
Not sure if this is an issue still (from what I read it didn't seem like MS was going to change it), or even for you.
.NET 1.0/1.1 - 2.0 only.
Several months ago the beta wasn't able to compile
grep -v -e "^\/\/" oldfoo.c > newfoo.c
My last experence with VS 2005 was very poor. The IDE itself may be ok, but the real problem lies with the C++ compiler.
On a project roughly the same size as yours. Moving from VS 2003 to VS 2005 generated 400+ compiler errors and thousands of warnings. This is up from 0 errors and 0 warnings with VS 2003 and g++.
The problem is one of lockin. MS depricated ALL of the C standard library. Every strlen() is now a compile error. Best of all the only documented way to enable the old functionality (some obscure #pragma) was broken.
Don't you have to upgrade to Visual Studio .NET to use the more recent DirectX SDKs? Is your case any different?
Intel should be avoided at all cost, as they purposely screw cause problems for AMD CPU's. And to think, this is _THE_ compiler I bought for MYSELF for my AMD machines before I found this out. Never again.
if 6.0 to 2003 is any indication Get ready for a lot of manual header adding. To convert, I had to create fresh ATL projects and re add all my header files because VS 2005 doesn't recognize the dsw. Kind of a pain in the ass, and, I cant really think of any benifits attained from doing it. If you're just coding w/ C/C++ id stick to 6.0. If you are trying to migrate to .net/c#, well I guess you'll have to go through this sooner or later.
Top 10 Reasons To Procrastinate
10.
... before moving your production code to any environment that is still in beta, you must destroy all of your backups.
Our code base is about 1M lines of C++ code + comments. We support production builds on MSVC6 and Linux (gcc 3.2) and solaris. We recently started building in .NET 2003. Apart from issues that we already confronted when porting to Linux (we had previously has some code using old iostreams, no longer supported after VC6), we had no siginificant porting issues. One issue that we have not yet solved is that link times are much worse, particularly when building against debug libraries. This is the main thing keeping us from moving to .NET for our production builds. We are hoping the situation improves with 2005, and if so may leap frog over 2003.
--
Twoflower
In my experience MS cares a lot about backwards compatibility. So if you used standard C++ code (may be with some anti-standards tweaks to get the VC++ 6.0 compiler work - it's a shitty compiler when it comes to C++ standards compliance) you should be fine. The APIs are still there, albeit some are now deprecated like the unsafe string handling functions - Your code will still compile but with warnings.
Needless to say your projects will be converted automatically.
And you might want to clean up the code of any VC6 compiler specific kludges as the VS 2005 C++ compiler is nearly perfect when it comes to C++ standards compliance.
If you are using any 3rd party libraries compiled with VC++ 6.0 you might need to get an updated version compiled for VS2005. I found it problematic mixing C++ libraries compiled by VC6 and VC7, for example.
so things like this (which you shouldnt be doing anyway):Wont Work Anymore
Several deprecation issues but overall it was a fairly smooth transition, but for us we already suffered and bled going from VC6 to 2003.NET
--Im an oven mitt, not an engineer! (SLArbys Radio Commercial)
I've had lots of various problems with small projects. What I've learned to do is port a few things at a time, especially if you have a lot of libraries and other things, you can try porting over a library and fix that up to keep running with other VS6.0 stuff while you slowly move it all over.
Of course the fun one would be download the trial beta and take a copy of all the code, build it, and see how many errors you get (hint: it will probably be a lot).
Sig!
Our company's main product currently has around 1.9 million lines of code. I've been running the beta compiler for months, and have found excellent performance gains over our normal builds which are created with VC6. Generally, I'm seeing execution times of around 2/3 of what they were before. This is on P4's, Athlons, and AMD-64's.
I had no trouble converting my projects from VC7 to the Beta, and I presume the VC6 to Beta would work well too. There will be a ton of warnings at first about deprecated functions like strcpy, but you can easily tell the compiler to ignore those (or use the new M$ functions if that's your style).
There are tons of new features that I haven't had a chance to use yet, but am looking forward to trying (like OpenMP).
And yes, this endorsement even comes from someone who in general is VERY anti-M$.
mod parent down! .....foolish mods!
anyone at all familiar w/ c programming knows he is speaking gibberish
--
Twoflower
Just saw you said VC, not VB. Not quite as bad in the conversion that way as you should already be using OO design. -Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
I would love to use VS2005 as an IDE for embedded development. Unfortunately, certain things are easy with VC6 and nmake, but awkward or impossible with VS2005 and VCBuild.
I was unable to setup my cross-compiler. With VS2005 it's possible to override the rule for *.c files and specify an alternate compiler, but there is no way (in beta2) to replace the built-in rule for *.o files and use an alternate linker. VC++ "custom build rules" are insufficient because they only act upon files that appear in the project, not files that are generated as output from a previous build stage. There are some half-baked workarounds like adding "dummy" *.o files to the project, but nothing I've found reasonable.
The MSBuild system looks awesome, but VC++ 2005 only has support for the VCBuild subset. It's a lot more limiting, and something to keep in mind.
VB.NET isn't VB7? Whew! It's a good thing they're using C++, then, isn't it?
I have a project that's about 1/3 the size of yours, with VC++ 6.0 as the development environment.
.NET. (In fact, my first reaction on seeing the IDE was: Good Grief! Why does everything nowadays have to be so complicated? I had hoped for a reaction along the lines of: Oh good! This looks like something I'm used to. But it was Not To Be.)
.NET compiler is going to have lots of support for fancy stuff like template metaprogramming. So I can see using it for new projects if the new stuff is going to be useful in those projects. But as for porting an old project, I have to assume that 2005 is going to be at least as far removed from 6.0 as 2003 .NET was. And since you already have the project building and working under 6.0, I would not recommend the switch.
.NET working, then that might be reasonable. But unless you have spare people/time, I honestly don't think it would be wise to try to make the switch
Out of interest I purchased VC++.NET 2003 a while ago.
Once I fired it up and tinkered a bit with the IDE, all thought of porting the project went away. Things look quite different (and, at least in my case, the help that came in the package was a big fat zero). I eventually worked out how to build a small test project and have it run. But to take a complex pre-existing project looked like a job that one would take on only if one absolutely needed something that was only available in 2003
Now, rumour has it that the 2005
Maybe if you have the capability and version control resources to keep using 6.0 as your mainline code while you tinker to get 2005
The question to ask is, why upgrade at all? Is there something wrong with MSVC 6? Does it all of the sudden not work?
If the only reason to upgrade is because some not-too-informed person (be it PHB or novice programmer) wants to be running the latest-and-greatest, then don't.
LOL, good catch. I'm going to go replace myself with a small shell script.
-Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
Mike
"Not an actor, but he plays one on TV."
As a n00b, I'll bite... what is the proper scope for the index of a for loop? That is, what *should* the code look like?
While the preferred method would be simply use Linux, unfortunately my company is using Microsoft Visual Studio 6.0 with C++
.NET classes work), but you should ideally be using a cross-platform framework like wxWidgets instead anyway.
Quit with the "Linux solves everything" cluelessness - Linux is not a C++ compiler. You mean to say that you think you'd rather develop under Linux than Windows. Okay, but then you have to decide what compiler (probably GCC) build system (Make, Scons?), version control (Subversion, CVS?) and what IDE or text editor to use (Eclipse, vi, Emacs?). If you're working in a team, it's going to be essential to at least standardise compiler and build system.
One thing you may be overlooking is that it's easy to duplicate what you refer to as the "Linux" toolchain experience on Windows - proving that there's nothing exclusively "Linux" about them. Thank GNU and the open source movement, not necessarily some guy from Finland:
* MingW32 is an excellent port of GCC to Windows. It probably has some difficulty compiling MSVC-specific code (I doubt MFC and
* Scons is a great Python based build scripting system. It leaves Makefiles in the dust as it allows you to use Python logic in the make process. I've personally run it on four different platforms (Windows, Linux, FreeBSD and Mac) and would never go back to Make. Although it helps, but is not necessary to be a Python fanatic (and if you don't know Python, take 20 minutes to follow the "Instant Python" tutorial linked on their site - it's possible you will fall in love with the language instantly).
* Eclipse is a nice cross-platform IDE that works well on Windows (and Linux, FreeBSD and the Mac). When used with the C++ extensions you get full syntax highlighting, project browsing and integrated debugging. Via custom project settings, it can be easily told how to build Scons projects instead of Makefile ones. (The only problem I've ever had working with Scons is requiring different settings to build Debug and Release builds, but I just set the IDE up to do Debug [work with that most of the time], then compiling and running Release from the command line).
And all of the above can be made to work nicely on Windows and Linux. If you switch to using those cross-platform tools on Windows, at some point your choice of platform becomes irrelevent and transitioning to Linux becomes extremely easy.
Now, I'm assuming that you're also planning to change the compiler you use in VC6 to whatever they've got for 2005. And this is where things get fun.
At my last job, we switched compilers on two occassions. The first time was a disaster, and our QA team was flooded with defect reports - see, as we did this shortly before a major release and learned a painful lesson.
Recently, we migrated from VC6 to the VC7 compiler. We continued to compile both versions for almost a year before we finally committed to the new compiler. I think the newer compilers are better for error detection in the compilation phase, but you will have to carefully watch out for subtle bugs that don't appear simply because of how the compiler used to behave.
A couple of years ago, there was a great article in Dr. Dobbs about using multiple compilers from different vendors as a great way to help catch errors in your code as well as use safer programming practices. Our migration pain highlighted just how much this one practice could have spared us in the long run.
...and what things do we lose?
...uhh but then you've already done that... damn!
why your eternal souls of course
These were the biggest areas of pain for me: Header file dependency changes, STL namespace issues, and linking model.
.NET the benefits would be substantial, of course.
The only benefit I found was smaller object code size. Oh, and debugging is somewhat improved. If you were going full-on
-I like my women like I like my tea: green-
Yes. Yes there is. It doesn't fully support the STL unless you use a 3rd party lib like STLPort. VC7 fixes this in addition to being faster and having a nicer gui.
What benefits are there, and what things do we lose? What problems will occur?"
.NET compilers (CSC, VBC, etc.) and the regular compilers (CL, etc.). CL compiles both normal C++ (I've used it on the same code I gave to g++) and Managed (Embraces and) Extensions for C++.
If you're looking mainly at upgrading the compiler, you can download the command-line compilers for free and you can see if it compiles well or not, or if language features you wanted to use are there. These are both the
Otherwise you're looking at upgrading the IDE, which is motivated by how much your programmers like or dislike the 6.0 IDE. And if you buy 2005, you're probably going to be upgrading both, so you need to make sure that both will work better (or one better, one as well) as those in 6.0.
I can see why a function like strcpy, which writes to memory, is unsafe, because it can keep writing forever if there is no terminating zero in the source string. But strlen is unsafe? Why? At most it will consume CPU when counting an unterminated string. It's implemented somehow like this: for (n = 0; *str; n++) str++; If the string is unterminated, eventually this function will segfault, but I cannot see any bigger harm done.
To get a rough idea of how bad it will be, download MS Visual C++ Toolkit 2003 (available for free) and recompile your code. From my limited experience with porting Visual C++ 6.0 code to Visual C++ 2003, look for lots of compiler errors. Those may be good to fix, though, since the C++ compiler seems to more closely follow the standards, and you'll be forced to make your code more standards compliant and probably more portable, too.
What a fool believes, he sees, no wise man has the power to reason away.
You can, you have to set a compiler flag for old syntax and 1.1
I work at MS, and we generally stay on top with compilers. In fact, our new security policies require all shipping code to be compiled with the 7.1 compilers, and pretty soon all code will be required to use 8.0.
/Zc:forscope- and /Zc:wchar_t- flags at first. One thing to be aware of is that some "errors" are actually warnings that are turned up to "error" status (see the /we flag). These can be changed with the /w flag or with a #pragma warning.
I'm the one who upgraded our 2-million line product from 6.0 to 7.1 and from 7.1 to 8.0. In the process, we had about 20,000 compile errors or warnings to fix. I think I was able to fix about 5,000 per week. It was a lot of work, but we actually found bugs and issues in the code. It was certainly worth the effort. Note that we don't actually use the VS IDE to build -- we use the compiler directly from the command line with makefiles.
In general, I would update to the new compiler and turn off all of the new warnings and errors until I got everything building. Then I would re-enable all of the new warnings and work on fixing them. Use the
Advantages to the new compiler:
* Better C++ Standards compliance.
* Much better code generation (your program runs faster).
* Many fixed "Internal Compiler Error" issues.
* A few fixed code generation (invalid optimization) issues.
* Many new warnings about things that deserve them.
* Much better debug information.
* Much better handling of templates.
Disadvantages to the new compiler:
* Somewhat slower compile time in some cases.
* Larger PDB (debug symbol) files.
Advantages to new C library:
* Much better C++ compliance.
* Many bugs fixed.
* Better performance.
* Many security fixes.
Disadvantages to new C library:
* Cannot expect runtime to be present on the user's system. (msvcrt.dll and mfc42.dll are already installed on most computers, but msvcr71.dll and mfc71.dll are not).
* Some porting incompatibilities.
Advantages to the new Visual Studio IDE:
* Better Intellisense.
* Support for excellent code coverage, profiling, unit test, and static analysis tools.
* Better debugging.
* Supported (VS 6.0 is 7 years old now -- all support for it is over).
Disadvantages to the new IDE:
* Uses more memory and system resources.
* Beta version has several performance issues. The final version should fix them (cross fingers).
General issues:
* You'll need to recreate your project (*.dsp) and workspace (*.dsw) files.
* Some porting will be required for MFC and ATL apps.
* You may hit one or two CRT changes.
* You may have several thousand warnings or errors. Nearly all of these can be eliminated via compiler flags or #pragmas, but you should really fix them if possible.
* Some CRT functions have been deprecated. You can add a #define to ignore this, but if you care about buffer overflows in your code, you should really take a look at using the "safe" versions.
Time flies like an arrow. Fruit flies like a banana.
If only for the better debugger...vc6 is what, 10 years old? I went (on a large scale app) from vc6->vc7.1 for our production code. You'll certainly have more work going from vc6 to vc8 directly. But the project file extensions changed, so its easy to use both your compilers side-by-side. Areas of pita were templates and for() loops and ATL generated unregistering code
http://superconfigure-supergroove.appspot.com/
I've been trying to build a c++ app w/ the original VS Studio .NET, and I'd really like to not link to the standard C libs at all (like libc.lib). I'd really like to just link to the main three: kernel32.lib, user32.lib and gdi32.lib. I've tried /NODEFAULTLIB but that leaves me hanging with a handful of unresolved linker refs to what appears to be auto-generated fct calls (like _RTC_CheckEsp and ___CxxFrameHandler).
Do you know if I can do a clean link to just the "main 3"?
I would really appreciate the help.
Peace & Blessings,
bmac
I'll have to check it out again then. At the time there were only crazy half baked hacks people had put together. If MS has given it better support I may switch over since I found it to be a pretty good improvement over VS2003.
Thanks for the info.
It would be a non-issue. If he's moving from VS 6.0, he isn't using .NET at all.
A small VC6 project (about 20,000 lines) to VC .NET 2003 took a few days to convert mostly because of changing compliance to standards between the 2 versions. Other than that only a few problems. But it still took a while, and because it was such a large change (almost every file in the project was changed) there was tons of time consumed in end to end testing (not counting the time used rewriting the now non-compiling code).
You are completely offtopic (as am I in responding), but you're also incorrect. VB.NET (.NET framework 1.x) is VB7, just as .NET Framework 2.x is VB8. It's even referred to that way in MSDN white papers. However, you are correct in your observations about MSFT breaking backwards compatibility in VB.NET and the crappyness of the converter. While the version is labelled 7, it might as well be a whole new language.
Agreed on the off topic, but as long as we are discussion...
.Net languages (C#, J#, VB.Net, ASP.Net, etc) are CLI based. When I compile my application in VB6, it creates a COM based Win 32 compatible, x86 native assembly. When I compile my app in VB.Net, C#, or any other .Net language, it gets compiles to CLI. The CLI assembly is then distributed. When a user runs it, the local Framework compiles the CLI into what ever native type is needed.
VB.Net is not the next version of VB. Just like C# is not the next version of C++. All
The converter is great. it works exactly how a converter should. The problem though is that VB.Net requires a completely different design theory. Imagine a 'converter' that changes a bicycle (VB 6) into a Car (VB.Net). The converter can identify the bicycle's frame, wheels, steering controls, and brakes and match them up loosely with the car's components. But a bike only has 2 wheels, a car has 4. The car now has an engine, but the bike doesn't, so it can't be converted. And so on.
As for the labeling. Yeah for some reason there are obscure references to VB7, which drives me nuts. But all of the presented version identifiers refer to it as VB.Net (2k2, 2k3, and 2k5)
-Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
Um, no.
http://blogs.msdn.com/loripe/archive/2005/05/02/4
-- "I never gave these stories much credence." - HAL 9000
There were significant changes in how ATL and MFC were used in VC 2002, so, you are going to have touch a fairly big portion of your code. I've found that for 64 bit targets, Visual Studio 2005 is not at all ready for prime time.
This is my sig.
It's kinda hard to trust a tool for 64 bit development when it itself is not 64 bit.
This is my sig.
It's not quite what you're looking for, but here goes:
.NET at home. One day I brought a copy of the project home and tried to build it. Errors and warnings abound. I gave up. Of course, my coworkers learned C++ "on the fly" in 1999 with this project and it shows. So if you wrote "good" code and you're not trying to do things you shouldn't be doing, like
//expecting the text "Alpha" to be in Text
We use 6 at my work. I have
enum EnumeratedType {Alpha, Bravo, Charlie, Delta};
CString Text;
EnumeratedType ET = Alpha;
Text = ET;
then you should be OK.
(go ahead and laugh, that's in the code MANY times)
(By the way, these are the same people that think SQL databases are for "bad programmers who can't roll their own")
Are you sure VC++ 2005 doesn't support nmake and CLI tools? Our group has been using makefile builds in every VC++ version for years, some of our colleagues have been working with the 2005 beta for a while now, and no-one's mentioned any fundamental changes...
If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.