在ubuntu11.10下的eclipse安裝手冊及安裝C、C++工具,ubuntu11.10下eclipse提示框背景色爲黑色的解決方案

一、環境安裝

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

然後用synaptic安裝Eclipse C/C++ Development

2.第二種方法是用命令:應用程序->附件->終端 然後輸入(中間可能需要你輸入密碼):
sudo apt-get install eclipse
sudo apt-get install eclipse-pde
sudo apt-get install eclipse-jdt
再安裝CDT(c/c++插件)
(1)同 2 中 在Work with的框框下輸入 http://download.eclipse.org/releases/indigo(注意如果你的eclipse版本是galileo,則輸入
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發揮代碼自動提示的功能呢?其實也很簡單:
打開終端:輸入:$ gcc -version
得到類似的:gcc 版本 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
很容易就看到你當前使用的版本了。
啓動Eclipse.進入:Windows-->Preferences-->C/C++找到Environment。增加兩個變量:
CPLUS_INCLUDE_PATH: /usr/include/c++/4.6.1(我的gcc版本)

C_INCLUDE_PATH: /usr/include

3.特別注意:c/C++程序運行時,先建立build project,然後才運行,如果你直接運行的話會出現:launched failed,Binary not found.


二、環境配置

(一)、C/C++環境配置:Window - Preferences - C/C++
1、Appearance,選中Group method definitions in the Outline view
2、 Code Style,通過New來新建一個代碼風格,命名爲qpsoft,且初始化爲BSD/Allmain,然後按習慣修改一些細節。我建議是採用默認的,或許是我過去編Java編寫習慣的原因。可按自己的意願來。
3、Editor - Content Assist - Auto-Activation - Delay(ms),原值爲500,改爲100,則智能提示速度將非常快!
4、Indexer,清空Files to index up-front的內容,修改Cache limits的值,儘可能大,可以提高速度!

(二)、修改智能提示快捷鍵:
Window - Preferences - General - Keys,輸入Content,找到Content Assist,在Binding中修改爲Shift+Space,要順手的多。
我覺得這個可以按照自己的習慣來,呵呵。

(三)、其他設置
1. Window - Preferences - General - Editors - Text Editors,選中Show line numbers,設置Print margin column爲110
2. Window - Preferences - General - Workspace,取消Build automatically,選中Save automatically before build
對於這個設置,我有點不明白,不過我也按照他這樣設置了。如有明白的,看到這篇文章,望留言解答。

(四)、通過插件擴展功能
1. 支持Subversion:Eclipse官方出品,主頁位於http://www.eclipse.org/subversive/。
在安裝時可以通過Help->Install New Software...,在work with框框複製地址:http://download.eclipse.org/technology/subversive/0.7/update-site/


三、ubuntu11.10下eclipse提示框背景色爲黑色的解決方案

ubuntu下eclipse提示框背景色爲黑色看起來很不舒服,這是因爲eclipse默認使用系統的主題,ubuntu11.10以前的版本可以通過 系統設置>外觀>修改主題 自定義顏色來修改。但ubuntu11.10下不再提供直接修改主題的接口,只能修改文件:/usr/share/themes/Ambiance/gtk-2.0/gtkrc

首先修改只讀權限,然後打開編輯,第一行的如下四個屬性即爲所需修改的部分:
selected_fg_color:選中前景色

tooltip_fg_color:提示框前景色 (#000000)

selected_bg_color:選中背景色

tooltip_bg_color:提示框背景色 (#f2edbc)

修改爲所需配色方案後,在系統設置切換一下主題,在切換回來就可以生效了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章