admin 管理员组

文章数量: 887019


What MinGW Is ?

     I recommend that anyone who is learning Standard C++ and who uses Windows for a primary development environment should use two compilers: the most modern version of Microsoft Visual C++(currently 2015) and the most modern version of GCC, the GNU Compiler Collection. Using two compilers that conform closely to the Standard subjects your code to more strenuous trials than using a single compiler would.

MinGW is a port of GCC to Windows. It is free of charge and simple to use (well, as simple as toolchains ever get). It produces standalone Windows executables which may be distributed in any manner. MinGW's official website mingw-w64 provides various builds, but I maintain my own distro because I demand complete control. (It's a long story, but mingw-w64 forked from mingw. Although my distro was based on mingw for many years, I now consider mingw-w64 to be the one true MinGW.)

Please note that I did not write any of the components of my distro. I simply compiled them and packaged them together.

How To Install ?

First, run the self-extracting archive. It'll ask you for a directory:

Whatever you say, it'll create a MinGW subdirectory there. I recommend saying C:\ (as in the screenshot) so it'll create C:\MinGW .

Second, click Extract. It'll display a progress bar:

Just wait until it's done. I've gone to great lengths to make the distro as small as possible, but Boost and git are very large, so there's a lot of stuff to extract.

Third, open the root of the distro, which is C:\MinGW if you followed my recommendation. There, you'll find two batch files and README_STL.txt . Inside the readme, there are copies of this webpage's Contents and History sections in case you forget which version of the distro you have or what it contains. There are also the following usage instructions:

Option A: In an existing Command Prompt, run set_distro_paths.bat to add the
          distro to that Command Prompt's PATH.

Option B: Create a shortcut to open_distro_window.bat, which will open a new
          Command Prompt with the distro on its PATH. You may move the shortcut
          to another directory (or the Desktop), and you may modify the
          shortcut's properties to start in a directory of your choice (for
          example, C:\Temp).

Leave set_distro_paths.bat and open_distro_window.bat in the root of the distro.

Neither Option A nor Option B permanently modifies your system.

Finally, type g++ --version in your Command Prompt and hit Enter. You should see something like this:

C:\Temp>g++ --version
g++ (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\Temp>

If you see something like that, then you have successfully installed MinGW.

Notes:

  • My distro is directory-independent, so you can put it in a directory other than C:\MinGW . If you feel like playing with fire, I even tested paths-with-spaces when I wrote my batch files, but I can't guarantee that all of the distro's components will be similarly tolerant.
  • You should not modify anything in the MinGW directory unless you know what you're doing. In particular, do not compile your programs there!

How To Upgrade

Simply replace C:\MinGW .

I shouldn't need to warn you about extracting a newer version of the distro into a directory which already contains an older version. That would create a mess.

How To Uninstall

Simply delete C:\MinGW .


From 点击打开链接

本文标签: mingw