星期五, 五月 01, 2009

Netbean 6.5 同cygwin c/c++ 工作生成独立.exe文件



cygwin编译生成的.exe在命令行运行的时候,会出现 需要 cygwin1.dll的提示。
非常的不方便.exe的发布。

根据提示可以在c/c++的项目 c++ 编译器里 额外的选项里加入 -mno-cygwin来利用mingw生成独立的.exe
并避免协议法律上的问题。
如图:


不过需要安装的额外的包包含如下:
通过http://cygwin.com/setup.exe 安装如下包
http://wiki.openttd.org/Cygwin
    • binutils: The GNU assembler, linker and binary utilities
    • gcc: C compiler
    • gcc-g++: GCC C++ compiler
    • gcc-mingw-core: Mingw32 support headers and libraries for GCC
    • gcc-mingw-g++: Mingw32 support headers and libraries for GCC C++
    • make: The GNU version of the 'make' utility
    • mingw-runtime: MinGW Runtime
    • subversion: A version control system
  • In the Libs section, you will need:
    • crypt: Encryption/Decryption utility and library
    • zlib: The zlib compression and decompression library
    • mingw-runtime: MinGW Runtime
    • w32api: Win32 API header and library import files
  • In the Mingw section, you will need:
    • mingw-zlib: mingw version of the zlib compression and decompression library.
  • Optionally you might want to install:
    • libpng12-devel from the Grahpics section for making PNG screenshots and loading PNG heightmaps.
    • libfreetype2-devel from the Devel section for using Windows' font in OpenTTD.