MinGW Introduction
MinGW, minimalist GNU for Windows, contains the GNU Toolset's runtime environment, theGCC compiler toolset, and other GNU program development tools such as make ,gawk, grep, etc.). Borrowing MinGW, you can use powerful, colorful, open source tools for software development on Windows operating systems, such as vim, GCC, Python, and more.
The official homepage of the tool is: http://www.mingw.org/
MinGW Installation
The standard MinGW installation process needs to be connected to the network online installation, you need to go to the website download page, download the latest installation files (Mingw-get-setup.exe), double-click to open the installation process:
Because the version of the installation file changes frequently, there is no longer a detailed description of the installation steps, but there are several points to note:
- MinGW The default installation location is "C:\MinGW", if there is no special requirement, follow the default
- During installation, the MinGW Installation Manager Installation management interface pops up, selecting the components that need to be installed. You need to select the following (if you need to compile C + + code, also check the g++ compiler)
- Depending on the number of components selected, the installer downloads the required packages, depending on the speed of the installation, which lasts for a period of time
Configuration of the MinGW
After the installation is successful, you can go to the MinGW command-line interface by executing "start"-"MinGW"-"MinGW Shell". At this point, familiar with the Linux friends will be a duck. But it doesn't matter if you're not familiar with it, so get familiar with it now.
Open the MinGW command line interface, you need to make some configuration, mainly including beautify the command line interface (the default is too ugly), download additional packages and so on.
- Install mintty using the Mingw-get command (Mingw-get is the package installation tool under MinGW, just like the apt-get of Ubuntu)
Mingw-get Install Msys-mintty
- Set up a shortcut to "C:\MinGW\msys\1.0\msys.bat--mintty" on the desktop
- Configure VIM, configure/etc/profile, and more
Compiler selection and use
MinGW installation, if Mingw-develop-toolkit is selected, it is installed by default for the X86 platform GCC compiler. If you need to compile source code for other platforms, you need a cross-compilation tool. The cross-compilation tool can be used in the "http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/" Free download (need to provide name and e-mail address), will be used in the cross-compiling tool, this is not explained in detail here.
Write the first program: Hello Word
1. Enter MinGW Shell
2. Use the VIM editor (why use vim?) I can only say that if a programmer is familiar with using vim to edit the code, it will never change! Create a new C file and add the following code
Vim MAIN.C
- #include
- int main(void) {
- printf("Hello world\n");
- return 0;
- }
3. After saving, use GCC to compile
GCC main.c
4. After the compilation is successful, "A.exe" is generated in the current directory, and the file is executed to print "Hello world".
./a.exe
[Email protected] ~]#./a.exe
Hello World
Original articles, forwarded please indicate the source. Snail Nest technology, www.wowotech.net.
Http://www.wowotech.net/soft/6.html
Windows system combined with MinGW to build a software development environment