介紹兩種方式使用eclipse編譯C/C++代碼
一、minGW + eclipse classic + CDT
(1) 下載安裝 minGW
地址:http://sourceforge.net/project/showfiles.php?group_id=2435
安裝到一級目錄下,如 D:\minGW。
安裝完畢,配置環境變數如下:
MinGW = D:\minGW
PATH = %MinGW%\bin; %PATH%
C_INCLUDE_PATH = %MinGW%\include
CPLUS_INCLUDE_PATH = %MinGW%\lib\gcc\mingw32\4.6.2\include\c++;%C_INCLUDE_PATH%
LIBRARY_PATH = %MinGW%\lib
(2) 安裝Eclipse Classic 4.2和相關外掛程式CDT
http://www.eclipse.org/downloads/
下載 Eclipse Classic 4.2
進入主介面,help -> install new softwares,
在 WorkWith 下選擇:Juno -
http://download.eclipse.org/releases/juno,
可以安裝很多外掛程式,例如 Programming Languages -> C/C++,CDT等。
建議使用此種方式。
二、minGW + eclipse c/c++ 版本
eclipse for C/C++版本內建了CDT外掛程式,直接下載 eclipse for C/C++版本。
Eclipse IDE for C/C++ Developers
http://www.eclipse.org/downloads/
使用:
File,new,C++ project, Makefile project,右側 Other Toolchain 選擇MinGW GCC。
編譯:
在產生的makefile檔案上右鍵,選擇 make targets, Build,單機Add按鈕,在彈出的視窗中輸入 target name,例如hello。
添加成功後,雙擊添加的target即可編譯。
使用請參考:http://wenku.baidu.com/view/701977bf1a37f111f1855b7e.html