• WinXP下MinGW的安装与配置


    到http://sourceforge.net/projects/mingw/ 手动去下载最新的MinGW,或使用MinGW-5.1.4.exe,自动下载。但后者往往不能下载到最新的稳定包。 

    1、手动下载说明,参见:http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite 
    可从:http://sourceforge.net/projects/mingw/ 选择包下载。 

    2、运行 MinGW-5.1.4.exe 的话,选择 Candidate,一般会下载最新的包,选择如下几项: 
    MinGW base tools 
    g++ compiler 
    MingGW Make 

    默认路径C:\MinGW,我装在 D:\cplusplus\mingw 

    根据:http://wiki.codeblocks.org/index.php?title=MinGW_installation,需要下载如下必要的包: 
        * http://prdownloads.sf.net/mingw/gcc-core-3.4.5-20060117-1.tar.gz 
        * http://prdownloads.sf.net/mingw/gcc-g++-3.4.5-20060117-1.tar.gz 
        * http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz 
        * http://prdownloads.sf.net/mingw/mingw-utils-0.3.tar.gz 
        * http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz 
        * http://prdownloads.sf.net/mingw/binutils-2.17.50-20060824-1.tar.gz 
        * http://prdownloads.sf.net/mingw/mingw32-make-3.81-1.tar.gz 
    另外一个是调试器:    
        * http://prdownloads.sf.net/mingw/gdb-6.3-2.exe 

    安装完后就配置环境变量吧。 

    控制面板--〉系统--〉系统详细设置--〉环境变量 
    MINGW_PATH=D:\cplusplus\mingw 
    C_INCLUDE_PATH=%MINGW_PATH%\include;%MINGW_PATH%\lib\gcc\mingw32\3.4.5\include 
    CPLUS_INCLUDE_PATH=%MINGW_PATH%\include\c++\3.4.5;%MINGW_PATH%\include\c++\3.4.5\mingw32;%MINGW_PATH%\include\c++\3.4.5\backward;%C_INCLUDE_PATH%
    LIBRARY_PATH=%MINGW_PATH%\lib;%MINGW_PATH%\lib\gcc\mingw32\3.4.5 

    PATH=%MINGW_PATH%\bin;%MINGW_PATH%\libexec\gcc\mingw32\3.4.5 

    注意:上面的很多3.4.5这个是gcc的版本号,要以真实的文件夹为准。 

    现在开一个CMD吧 
    输入g++ --version 
    看到以下信息的话就成功一半了。 
    Reading specs from D:/cplusplus/mingw/bin/../lib/gcc/mingw32/3.4.5/specs 
    Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi 
    th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis 
    able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d 
    isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with 
    out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl 
    e-hash-synchronization --enable-libstdcxx-debug 
    Thread model: win32 
    gcc version 3.4.5 (mingw-vista special r3) 

    继续新建一个test.cpp文件 
    内容如下 
    #include <iostream> 
    using namespace std; 
    int main(int argc, char** argv) 

    cout << "Yeah, MinGW!" << endl; 
    return 0; 

    在cmd下面输入编译命令 
    g++ -o test test.cpp 
    这次是什么都没看到就是成功了。 

    接着输入test.exe 
    看见以下的信息了么 
    Yeah, MinGW! 

    现在,可以在XP下面编写你的C或者C++程序了。


  • 相关阅读:
    对ArcGis Engine的增、删、改实现
    修改 ArcGis Engine 图层字段值
    获取DataTable 删除行的数据
    使用Kdiff3 来解决Git的文件冲突
    WordPress 用Windows Live Write写日志
    在GIT 中增加忽略文件夹与文件
    解决WinDbg下不能用 !ClrStack a
    DevExpress 实现下拉复选控件
    解决远程桌面连接后没有声音的问题
    读书
  • 原文地址:https://www.cnblogs.com/java20130726/p/3218606.html
Copyright © 2020-2023  润新知