歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 10.04 Eclipse C/C++平台搭建

Ubuntu 10.04 Eclipse C/C++平台搭建

日期:2017/2/28 16:27:08   编辑:Linux教程

平台搭建環境:Ubuntu 10.04,最新的Ubuntu 10.10相信也一樣。

1 安裝eclipse:

第一種是通過Ubuntu自帶的程序安裝功能安裝Eclipse,應用程序 ->Ubtuntu軟件中心,搜Eclipse安裝即可。

第二種方法是用命令:應用程序->附件->終端 然後輸入(中間可能需要你輸入密碼):

sudo apt-get install eclipse

sudo apt-get install eclipse-pde

sudo apt-get install eclipse-jdt

2 安裝中文語言包

菜單欄:Help------>Install New Software------>在Work with的框框下輸入以下地址回車。

http://download.eclipse.org/technology/babel/update-site/galileo

選擇簡體中文: Babel Language Packs in Chinese (Simplified)

然後就是選擇簡體中文安圖提示一步步安裝

3 安裝CDT(c/c++插件)

(1)同 2 中 在Work with的框框下輸入 http://download.eclipse.org/releases/galileo

選擇Collaboration->Mylyn Bridge: C/C++ Development,安裝,重啟eclipse

(2)同上輸入網址後選擇 Programming Languages->Eclipse C/C++ Development

切記:(1)(2)順序有依賴關系,安裝順序不能顛倒。

在安裝cdt的時候,會報這個錯誤:
An error occurred while installing the items
session context was:(profile=PlatformProfile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Install, operand=null --> [R]org.eclipse.cvs 1.0.400.v201002111343, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallBundleAction).
The artifact file for osgi.bundle,org.eclipse.cvs,1.0.400.v201002111343 was not found.

後來google了一下,發現解決辦法。
sudo apt-get install eclipse-pde
在裝cdt插件,完成~

用Eclipse+CDT開發c/c++項目的時候,怎麼能讓Eclipse發揮代碼自動提示的功能呢?其實也很簡單: 【LINUX公社 www.LinuxIDC.com 】

打開終端:輸入:$ gcc- v

得到類似的:gcc 版本 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

很容易就看到你當前使用的版本了。

啟動Eclipse.進入:Windows-->Preferences-->C/C++找到Environment。增加兩個變量:

CPLUS_INCLUDE_PATH: /usr/include/c++/4.1.3(我的gcc版本)

C_INCLUDE_PATH: /usr/include

接下來新建一個c project.編寫代碼的時候,當敲入'.'的時候就會自動彈出可備用的代碼。

Copyright © Linux教程網 All Rights Reserved