Ubuntu下搭建eclipse C/C++开发环境 [2014-01-16更新]

时间:2023-01-22 16:41:06

1. 安装eclipse

$ sudo apt-get install -y eclipse eclipse-pde eclipse-jdt
------------------------------------------

2. 安装C/C++插件(CDT)


运行eclipse,选择 Help --> Install New Software... 菜单项在 Work with 输入 http://download.eclipse.org/releases/galileo/
依次安装(存在依赖关系,必须按顺序安装,安装完一个后重启eclipse再安装下一个):Collaboration --> Mylyn Bridge: C/C++ DevelopmentProgramming Languages --> Eclipse C/C++ Development Tools
------------------------------------------

3. 配置环境变量


运行eclipse,选择Windows --> Preferences --> C/C++ --> Environment 菜单项
添加 C_INCLUDE_PATH=/usr/local/include:/usr/lib/gcc/i486-linux-gnu/4.4.3/include:/usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed:/usr/includeC_INCLUDE_PATH 的值通过下述操作获得:$ echo "int main() { return 0; }" > hello.c$ gcc -v hello.c...#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.4.3/include
 /usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed
 /usr/include

添加 CPLUS_INCLUDE_PATH=/usr/include/c++/4.4:/usr/include/c++/4.4/i486-linux-gnu:/usr/include/c++/4.4/backward:/usr/local/include:/usr/lib/gcc/i486-linux-gnu/4.4.3/include:/usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed:/usr/includeCPLUS_INCLUDE_PATH 的值通过下述操作获得:$ echo "int main() { return 0; }" > hello.cpp$ gcc -v hello.cpp...#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.4
 /usr/include/c++/4.4/i486-linux-gnu
 /usr/include/c++/4.4/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.4.3/include
 /usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed
 /usr/include

参考资料:http://www.360doc.com/content/11/0114/23/5480484_86628147.shtmlhttp://blog.csdn.net/wudiwo/article/details/7682320