Windows environment uses MINGW to establish a simple C language development environment

Source: Internet
Author: User
Tags sublime text

MinGW, is the abbreviation for minimalist gnufor windows. We use MinGW to build a simple C language development environment.

First, install the MinGW

First go to the official website to download MinGW installation package: http://www.mingw.org/

In the left sidebar, click Download under Navigation.

Jump to SourceForge, download the latest version directly

Open the installation package to install MinGW.

Select Install.

Here you choose the installation path and some options, by default. Click Continue.

MinGW start downloading resources. Click Continue to continue after the download is complete.

Select the package you want to install, click on the left basic setup, select Mingw32-base and mingw32-gcc-g++ in the list. Select the mode, click on the left box, and select mark for installation in the pop-up menu.

menu, select installation, apply changes, pop-up window click Apply to start the installation.

Be patient for some time. Close closes the window when the installation is complete.

Close the window.

Second, configure environment variables

Right-click My Computer, properties, advanced system settings

In path, add the bin directory under your MinGW installation directory, mine is: E:\MinGW\bin.

Open cmd, enter gcc-v and g++-V, and you can see that the installation is complete.

Three, write a simple Hello world.

Write a simple HelloWorld program with Notepad. I saved it in the F-packing directory, named TEST.c. Editor you can use Vim, Emacs, Vscode, Sublime text, Atom, and so on, or use the Notepad that comes with Windows.

#include <stdio.h>int  main () {    printf ("Hello world! " );     return 0 ;  }

Open cmd, enter the directory where the file is located, enter GCC test.c, you will find a a.exe in the F-disk, this is our compiled executable file. Run, Hello World, Success!

If you want to generate an executable file that is not called a.exe, but other names, you can use GCC test.c-o name, where the name is the file name you want.

So far, we have built a simple mingw-based small C language development environment.

Windows environment uses MINGW to establish a simple C language development environment

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.