MinGW的下载和环境配置

1.在MinGW官网下载MinGW Installer

2.在安装界面勾选所需的组件,在右侧界面标记,在菜单栏Installation中选择Apply Change,等待安装

 

3.环境配置:在环境变量Path中,将MinGw的bin目录路径添加到Path中。

4.检验

1) 在C盘下新建一个helloworld.c文件,源代码如下: 

#include <stdio.h> 

main() { 
    printf ("Hello World!\n"); 
     
    return 0; 


2)编译。 
C:\>gcc -o helloworld.exe helloworld.c 

3)运行。 
C:\>helloworld.exe 
Hello World!This is my first c program! 

 

1) 在C盘下新建一个helloworld.cpp文件,源代码如下: 

#include <iostream> 

main() { 
    std::cout << "Hello world!This is my first c++ program!" << std::endl; 
     
    return 0; 


2)编译。 
C:\>g++ -o helloworld.exe helloworld.cpp 

3)运行。 
C:\>helloworld.exe 
Hello world!This is my first c++ program!

 

posted @ 2016-01-23 20:36  Phil Li  阅读(404)  评论(0编辑  收藏  举报