关闭

[TICPP 2nd 习题][02][选择合适的编译器]

997人阅读 评论(0) 收藏 举报

标题: [TICPP 2nd 习题][02][选择合适的编译器]
作者: Jack Yang
日期: 2006/06/22
状态: 未完

开始做习题之前,必须作的一件事情就是选择一个合适的编译器,选择的标准就是这个编译器必须尽可能全的支持C++的ISO标准。

下面是Bruce Eckel对W32编译器所做的评价
http://mindview.net/Books/TICPP/ThinkingInCPP2e.html#Compilers

Win32 Compilers

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 ]

 从中可以看出Bruce Eckel认为不错的编译器有
1.  MS为.NET平台开发的新版C++编译器
2.  Digital Mars 编译器(free)
3.  开源的GCC编译器(g++)

权衡再三,准备使用g++,并且配合Cygwin.那么接下来的工作,就是把Cygwin和g++等相关环境都架设好。

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:530343次
    • 积分:6916
    • 等级:
    • 排名:第3313名
    • 原创:145篇
    • 转载:85篇
    • 译文:0篇
    • 评论:212条
    最新评论
    好友的Blog