編譯器選擇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