eclipse3.2配置开发C/C++
eclipse3.2配置開發C/C++
1,下載cdt
網址:http://download.eclipse.org/tools/cdt/releases/callisto/dist/3.1.1/??? (注意eclipse3.2只能和cdt3.X的版本結合)
2,配置cdt
把下載的壓宿包解壓后,把相應的features和plugin下的內容拷貝到eclipse相應的目錄下......啟動eclipse看cdt插件安裝是否成功
3,下載mingw(這是用來編譯c C++的編譯器)
http://www.mingw.org/download.shtml??????
4,配置mingw
在path中加入mingw的bin??
(如果系統已經有其它的C/C++編譯器,請把C:\MinGW\bin; 加在path的最前面)
5,建立C項目
File->new project->Standard Make C Project。按下Next。 Project name:HelloC。按下Next。 選擇Binary Parser,將Binary Parser原來選取的Elf Parser取消,選取PE Windoes Parser。選擇C/C++ Indexer,選擇no indexer(search features will not work correctly),按下Finish。
6,建立源文件Hello.c
#include <stdio.h>
main()
{????????
??????? printf("hello!\n");
?????? system("pause");
}
7,建立makefile文件,注意不需要后綴名
all:
????? gcc -g -o hello hello.c?? 或者 gcc?? hello.c -g -o hello
(注意hello是生成exe的對象名,gcc前面是tab)
-g是生成調試信息,-0是生成對象名,這里編譯參數意思請參照這里:
http://hi.baidu.com/lovekaili/blog/item/9751bfd3172421073af3cfa1.html
8,建立make target
Windows->Show View->Make Targets。在Make Targets視窗中按下右鍵,選擇Add Build Target,Target Name輸入:compile,Make Target輸入:all。雙擊編譯即可完成編譯。可以看到Console輸出:
make -k all???????
gcc -g -o hello hello.c
9,進入工程目錄下運行hello.exe,是不是有了你想要的結果了,呵呵~!
總結
以上是生活随笔為你收集整理的eclipse3.2配置开发C/C++的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Windows + Eclipse +
- 下一篇: C/C++内存分配方式 .