MinGW is the product of porting the GCC compiler and the GNU Binutils to the Win32 platform, including a series of header files (WIN32API), libraries, and executables. MinGW was developed from the Cygwin (1.3.3 version). Most of the languages supported by GCC are also supported in MinGW, which covers C, C + +, OBJECTIVE-C, Fortran, and Ada. For languages other than C, MinGW uses the standard GNU runtime, such as C + + using the GNU libstdc++. However, MinGW uses the C Runtime library in Windows. Therefore, programs developed with MinGW do not require additional third-party DLL support to run directly under Windows, and do not necessarily have to comply with GPL licenses. This also caused the program developed by MinGW to use only Win32API and cross-platform third-party libraries, and without POSIX support [3], most GNU software cannot compile with MinGW without modifying the source code. Specific details can be seen on the official website.
First, download MinGW
After the download is complete, double-click Open to start the installation, it is recommended to install to the C drive
When the installation is complete, the desktop will appear with one of the following icons:
This is an installer, double-click to open the following interface:
Right-click on "Mark for Installation" and select "Installation, Apply changes". Wait for the download to complete.
Second, the configuration MINGW environment variable
After the installation is complete, configure the environment variables, the g++ compiler in the bin directory, configured as follows:
Third, configuration sublime Text 3
Click Tools--Build system--and new Build system, which opens a new page, copies the following content, and saves it as Myc++.sublime-build
{"cmd": ["g++", "${file}", "-O", "${file_path}/${file_base_name}"], "File_regex": "^ (.. [^:]*]:([0-9]+):? ([0-9]+)?:? (. *) $ "," Working_dir ":" ${file_path} "," selector ":" Source.c, source.c++ "," Encoding ":" cp936 "," Variants ": [ { "Name": "Run", " cmd": ["${file_path}\\\\${file_base_name}.exe"] }]}
You only need to Ctrl+B
see the output in the sublime Text 3 console after you call compile and then type Ctrl+Shift+B
run.
Iv. Testing
Create a new test.c file, Ctrl+b,ctrl+shift+b, and run the following results:
#include <stdio.h>int main () {printf ("Hello world!\r"); printf ("Xixi"); printf ("Hello world!\n"); printf ("Xixi") ; printf ("Hello world!\r\n"); printf ("Xixi"); return 0;}
Sublime integrated MinGW to create a/C + + development environment