2010-12-20 81 views
0

我在目錄C:\MinGW中安裝MinGW編譯器套件,並設置PATH環境。我不知道任何項目中的用法,我想用編譯器編譯我的程序,但我不知道這些步驟。我如何使用GCC編譯我的程序?MinGW編譯器套件

+0

這裏是[教程](https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html) – 2016-01-06 10:34:55

回答

0

我通常從SourceForge using the automated installation安裝MinGW的。

選擇「mingw-get」。然後,一定要安裝GCC C++編譯器功能。要檢查安裝是否正常,請在命令行中輸入「gcc -v」。您應該查看GCC版本。

如果不起作用,請檢查您的系統路徑。 「C:\ MinGW \ bin」應該正確配置。

要以簡單快捷的方式開發您的應用程序,您可以下載用於Windows的Eclipse-CDT

Eclipse不需要任何安裝。解壓縮到您想要的目錄並準備好工作。如果它不起作用,您可能需要先安裝Java虛擬機。

Eclipse會自動檢測您的MinGW安裝,因此您不需要執行任何操作。

創建一個新的C項目(選擇測試項目「Hello World」或編寫自己的項目),然後編譯並運行。

0
1. Download MinGW 
2. Check mingw folder exist in C drive. If it exist go to step 3. 
3. set environment variable in environment name "c:\mingw\bin" and press OK. 
4. Go to command Prompt type mingw-get install gcc 
5. after the installation of gcc, type powershell in command prompt. 
6. from powershell Browse to the folder where your source files are residing. 
7. type "gcc yourprogram.c", it will compile the source code 
8. type "./a.exe" you will get your output on console. Enjoy