MinGW installation and use under Windows

Source: Internet
Author: User

    1. Download, unzip, and install the MinGW. :

      Http://yunpan.cn/cJGXp6NWL8vPQ (Extract code: 7B22)

    2. Locate the installation path for the MinGW and copy it.

    3. On the desktop, right-click computer---> Properties---> Advanced system settings---> Environment variables---> System variable (S)

    4. Finding the variable "path" in "System variable (S)" and double-clicking it will bring up a "Edit system Variable" dialog box and add the path you just copied in the variable value. Then, "OK" all the way.

    5. Open a command line prompt:

      Start (or shortcut: WIN+R)---> Run (enter cmd)---> OK (or carriage return)---> Enter command gcc-v---> enter.

      END
Precautions

In the fourth step, in the "Variable Value" column, before adding the path, the (English state) is used to separate the positions, must not be less

Using GCC under Windows environment

MinGw is the Minimal GNU on Windows abbreviation that allows local Windows programs to be generated on Gnu/linux and Windows platforms without the need for a third-party runtime library. This paper mainly introduces the installation and use of MinGw.

(i) Installation

    •  1. Download MIN-GW Installer, link: http://sourceforge.net/projects/mingw/files/, download Download Mingw-get-setup.exe (86.5 kB)
    •  2. Run Download Mingw-get-setup.exe (86.5 kB), click "Run", continue, etc., note the installation of the directory, such as  C:\MINGW, the following modifications to the environment variables will also be used.
    •  3. Modifying environment variables:

       

      Select Computer-Properties---Advanced system settings---Environment variables, locate the Path variable in the system variable, and then add the installation directory for MIN-GW, such as  c:\mingw\bin

    • 4. In the Start menu, click "Run", enter  cmd, open command line: input   mingw-get, if the MinGW Installation Manager window pops up, the installation is normal. At this point, close the MinGw Installation Manager window, or the next step will error
    • 5. Enter the command in cmd  mingw-get install GCC, wait a while, GCC is installed successfully.

If you want to install G++,GDB, just enter the command mingw-get install g++ and mingw-get install GDB

(ii) Use

In the current working directory of CMD write C program test.c:

# include <stdio.h>int main(){ printf("%s\n","Hello World") ;  return0;}              

Enter the command in cmd gcc test.c

The A.exe executable is generated under the current directory, and the program is executed by entering a.exe in CMD.

If you want to debug a program, you can enter GDB a.exe

To go to GDB, you can debug a program using GDB's common commands.

MinGW installation and use under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.