之前用臺灣和國內的源,安裝eclipse都不成功,修改爲骨頭源就可以了。
傳說中的“骨頭源”(SRT源)
骨頭源爲Ubuntu論壇成員bones7456(人稱骨頭兄)親自搭建並維護的Ubuntu更新源,這個Ubuntu全新源位於浙江杭州百兆共享寬帶的電信機房,保證源的及時同步和完整性是該源的重要特色。該源的同步頻率是間隔兩小時模式
骨頭源,提供ubuntu,deepin
deb http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
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發揮代碼自動提示的功能呢?其實也很簡單:
打開終端:輸入:$ 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 �