新版本的gcc已经不支持 -mno-cygwin了。在cygwin中编译(1)中的代码,会出现如下的信息:
gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler.
提示说要可以用MinGW来代替,gcc好人性化,赞!
google了下,国内的大部分都是说加上-mno-cygwin就可以不依赖cygwin1.dll库了,但是并没有说新版本的gcc不支持-mno-cygwin编译选项了。
去MinGW网站http://www.mingw.org/,下载在线安装包mingw-get-inst-20110530.exe,这样安装的好处是不需要自己去设置环境变量,直接下一步下一步,选择安装gcc,g++,msys base system等包,安装完成就可以在windows下使用gcc和g++编译器了。
转载自mingw官网
MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (Itdoes depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applicationsmust ship with a freely distributable thread support DLL, provided as part of MinGW itself).