MinGW 是一个可自由使用和自由发布的Windows特定头文件和使用GNU工具集导入库的集合,允许你在GNU/Linux和Windows平台生成本地的Windows程序而不需要第三方C运行时库。这个和Cygwin(面向POSIX标准)是不同的。
本示例用的版本:mingw-x32-gcc-4.8.1-posix-dwarf-rev2
下载地址:
http://download.csdn.net/detail/u011669055/6317573
老旧的经典版本:mingw 5.1.6 with gcc 3.4.5
下载地址:
http://www.pc6.com/softview/SoftView_56757.html
最新的可到官网下载:
http://www.mingw.org/
直接解压安装即可,建议安装到 C:\mingw目录,方便使用。
完毕,再设置环境变量。为了方便和移植,我们创建一个mingw-env.bat,内容如下:
@echo off
set MINGW_HOME=C:\MinGW
set C_INCLUDE_PATH=%MINGW_HOME%\include;
set CPLUS_INCLUDE_PATH=%MINGW_HOME%\lib\gcc\i686-w64-mingw32\4.8.1;%MINGW_HOME%\lib\gcc\i686-w64-mingw32\4.8.1\include;%MINGW_HOME%\lib\gcc\i686-w64-mingw32\4.8.1\include\c++;%MINGW_HOME%\lib\gcc\i686-w64-mingw32\4.8.1\include\c++\backward;%MINGW_HOME%\include;
set LIBRARY_PATH=%MINGW_HOME%\lib;
set PATH=%MINGW_HOME%\bin;%MINGW_HOME%\i686-w64-mingw32\lib;%PATH%;
echo *** MinGW ENV SET OK ***
@echo on
当然,你也可以不使用bat,直接设置系统或用户的环境变量也可,这里不再赘述。
如果你的mingw不是安装到默认的C:\MinGW目录,请修改MINGW_HOME的指向。
接着桌面创建一个快捷方式,目标设置为:C:\Windows\System32\cmd.exe /K C:\mingw\mingw-env.bat 这样,后面直接双击这个快捷方式即可进入mingw的命令窗口环境,十分方便。
最后进行下面三项测试,看看环境是否工作正常:
1、gcc -v
2、gcc -o hello1.exe hello1.c
#include <stdio.h>
int main( int argc, char *argv[] )
{
printf( "Hello World!\n" );
return 0;
}
3、g++ -o hello2.exe hello2.cpp
#include <iostream>
using namespace std;
int main( int argc, char *argv[] )
{
cout << "Hello World!" << endl;
return 0;
}
*** 附:MinGW的官方介绍 ***
MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.
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. (It does 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 applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).
MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes.
MinGW, being Minimalist,
does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider
Cygwin instead.
Primarily intended for use by developers working on the native MS-Windows platform, but also available for cross-hosted use, (see note below -- you may need to follow the "read more" link to see it), MinGW includes:
A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
GNU Binutils for Windows (assembler, linker, archive manager)
A command-line installer, with optional GUI front-end, (mingw-get) for MinGW and MSYS deployment on MS-Windows
A GUI first-time setup tool (mingw-get-setup), to get you up and running with mingw-get.
MSYS, a contraction of "Minimal SYStem", is a Bourne Shell command line interpreter system. Offered as an alternative to Microsoft's cmd.exe, this provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform; a light-weight fork of Cygwin-1.3, it includes a small selection of Unix tools, chosen to facilitate that objective.
分享到:
相关推荐
在windows环境下安装和配置mingw以及从源代码安装emacs这个软件,这个东西配置了两天,终于可以成功,有关软件和安装步骤及所需的配置环境,里面写的很详细~~
Windows_XP下MinGW的安装与配置,Windows_XP下MinGW的安装与配置,
windows下vscode配置Mingw-附件资源 windows下vscode配置Mingw-附件资源 windows下vscode配置Mingw-附件资源 windows下vscode配置Mingw-附件资源 windows下vscode配置Mingw-附件资源 windows下vscode配置Mingw-附件...
Windows下MinGW的安装与配置 Eclipse搭配C++环境 excel文档
Windows下需要使用mingw来编译一些开源的库,但是mingw需要网络访问,所以下载起来比较麻烦,这里直接将我的mingw配置上传上来,方便大家使用
在windows环境下设置mingw的环境变量
ubuntu20.04离线安装mingw-w64
Windows下的minGW zip包,下载解压直接可用,需要配置path,配置方法可百度。
Windows下Qt+minGW+CMake+Opencv4.3编译配置。使用cmake+mingw编译好的opencv4.3版本的安装包,直接白嫖就可以。
这个是sublime text2的MinGW的 build system的windows下的配置,个人完成的。
MinGW能使你的Windows支持gcc 编译c或c++;本包是已经从MinGW官网下载好资源的包,只需要解压后配置好环境变量就可以使用.更新时间2018/7/25
MINGW+MSYS环境已经配置完成。 移植到其他电脑上时需要根据情况做修改: 若msys文件夹放在D盘根目录下,找到D:\msys\1.0\etc\fstab,以记事本或写字板打开, 将以下所示部分改为现在实际所在的路径,即D:/msys/1.0/...
notepad++只是一个文件的编辑器 MInGW配置结束可以使用gcc编译 在windows下使用C语言开发运行
window下的gcc环境,解压文件之后得到 MinGw,将 ../MinGw\mingw64\bin 配置到path路径即可使用
可用于在Windows编译X264、ffmpeg等开源软件。MinGW已配置好msys和nasm,直接将bin文件夹这个路径配置到系统变量即可使用,可以在命令行中输入“gcc -v”和“nasm -v”进行验证。
Windows系统中玩rust,通过Rust-Init.exe准备rustup.exe, 用rustup 安装gnu工具链前,需要准备gnu编译环境。解压这里的下载的mingw64.rar到任意文件夹,比如d:\programs, 将d:\programs\mingw64\bin添加到Path路径中...
Windows下使用MinGW编译配置Qt-OpenCV开发环境
1.解压压缩包内容到目的安装盘新建MinGW64目录; 2.配置环境变量;例:Path:D:/MinGW64/bin 3.打开Windows cmd命令行,分别输入gcc,g++,gdb --version,显示版本,说明配置成功; 4.最后打开eclipse,就可以新建C/...