[TICPP 2nd 习题][选择合适的编译器]
标题: [TICPP 2nd 习题][选择合适的编译器]
作者: Jack Yang
The code in these books has been written to compile under a fully- compliant ISO C++ (Standard C++) compiler. A command-line version of the Borland C++ compiler is available as a free download. This compiler isn't fully compliant with all standard C++ features; you can find the files that it won't compile (which are excluded from the makefiles) in the file CompilerData.txt which comes with the distributions. While old Visual C++ is not so good, the new Microsoft C++ for .NET (payware) is very good. The free Digital Mars compiler is also very good.
The open-source GCC compiler (g++) is one of the most compliant C++ compilers available. This compiles and runs very well under Linux, but you can also run it under Win32 using Cygwin at http://www.cygwin.com/, which is gcc + the bash shell and gnu utilities ported to Windows. If you've ever used Unix, Cygwin will give you back what you missed -- it's truly remarkable. You can actually compile and run virtually any non-gui Unix application under Cygwin. If you use make, it solves all the problems of trying to use make under Win32.
To learn more about installing Cygwin and GCC on your Win32 machine, see here.
A note about pre-.NET Visual C++. I periodically receive messages saying that Visual C++ will not compile many of the programs in the book. Let me attempt to be diplomatic here. Before .NET, Microsoft stated that what they are creating is "a Windows compiler." Their interest was in creating a compiler that makes Windows programs, and not one that is compliant to the C++ Standard. As a result, the Standard C++ features in pre-.NET VC++ increased at a relative crawl, and you should not expect that compiler to compile many of the programs in the book. The complete listing of files that will not compile can be found in the file CompilerData.txt in both volumes.
If you find a problem with a program and pre-.NET VC++, it is extremely likely that it is a deficiency in VC++ and not in the code listing. A Microsoft makefile is included that will successfully compile all possible programs in the book.
So the upshot is this: if you want to use Microsoft C++, choose Managed C++ for .NET.
Here is a file msfix.h which was created by Chuck Allison to fix the return from main warning and the for loop namespace scope issues in the Visual C++ compiler. [ Click here to download ]
2. Digital Mars 编译器(free)