配置:
1. Eclipse CDT (C/C++ Development Tooling) eclipse CDT 是 Eclipse 插件,它将把 Eclipse 转换为功能强大的 C/C++ IDE。
到http://www.eclipse.org/cdt/downloads.php下载对应版本的CDT
2. Eclipse-> Help->Install New Software->Add
Name 填写 CDT , Location填写下载的CDT位置
勾选CDT Main Features CDT Optional Features
Contact all update sites during install to find required software的√去掉
3. ->Next->Finish, 重启Eclipse ,Help ->About Eclipse, 点选C/C++图标 OK
注意:An error occurred while collecting items to be installed
安装的时候把Contact all update sites during install to find required software的√去掉即可
因为Eclipse是Java写的,所以要安装Java的JRE或JDK、编译器要安装MinGW并设置环境变量
启动Eclipse,不同的语言设定不同的工作区,这很 重要,否则很容易配置混淆,造成编译错误。
编译C程序 :
1. 创建c工程:File->New->C Project->Executale,填写Project name ,选择Location,选Empty Project ,MinGW GCC,Finish
2. 工程文件夹右键->New File->File name ->创建.c文件,编辑文件
3. 工程文件夹右键->Build Project
4. Window->Perspective->Open Perspective->Other...->C/C++
5. Run as ->local C/C++ Application
编译C++程序:
1. File->New->C++ Project->Executale,填写 Project name, 选Hello World C++ Project ,MinGW GCC,Finish
2. 工程文件夹右键->Build Project
3. Run as ->local C/C++ Application
Eclipse 设置:
1. window--preferences--general--workspace-->text file encoding--other:utf-8//解码
2. window--preferences--general--appearance--theme:dark //黑色主题
3. window--preferences--general--appearance--colors and fonts
-->basic--text font--14//字体
4. window--preferences--show view--navigator//导航
来源:oschina
链接:https://my.oschina.net/u/4300922/blog/3520204