C語言環境搭建

編譯器選擇gcc,下載地址:https://sourceforge.net/projects/mingw/files/MinGW/

這裏寫圖片描述

安裝MinGW,我安裝在了C盤,位置爲:C:\MinGW
運行:C:\MinGW\bin\mingw-get.exe ,在應用程序中窗口右側選擇要安裝的包,然後選擇Installation->Apply Changes 安裝包。

編寫first.c的C語言文件,放在了C:\MinGW\msys\1.0\home\Leen 目錄下面,如:
這裏寫圖片描述

然後運行C:\MinGW\msys\1.0\msys.bat,會出現一個命令窗口,如:
這裏寫圖片描述
在窗口可以使用gcc first.c 命令,如:
這裏寫圖片描述
這樣在C:\MinGW\msys\1.0\home\Leen 目錄下面就會多一個a.exe 可執行文件,如:
這裏寫圖片描述

然後在窗口直接運行a.exe 就能執行成功,如:
這裏寫圖片描述

其中,first.c文件的內容爲:

#include "stdio.h"
int main(void)
{
    /* code */
    int number;
    number = 1024;
    printf("I'm Leen! I can, I belive me.\n\n");
    // printf("This number is %s\n", number);
    printf("This number is %d\n", number);
    return 0;
}

Author:leedaning
本文地址:http://blog.csdn.net/leedaning/article/details/54847422

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章