在ubuntu10.04上使用源代碼安裝codeblocks10.05有點複雜,根據網上搜索本人將自己的安裝過程總結如下,供各位參考。本文參考了文章:http://blog.163.com/fanxingrong@126/blog/static/1126519542011125111852289/和http://ubuntuforums.org/showthread.php?t=1380848,當然也看了其它幾篇文章。
首先是更新源並安裝key:
(1) sudo gedit /etc/apt/sources.list
(2),在文件的末尾添加
deb http://apt.tt-solutions.com/ubuntu/ feisty main
deb http://apt.tt-solutions.com/ubuntu/ edgy main
(3) 安裝key:
wget http://www.tt-solutions.com/vz/key.asc
sudo apt-key add key.asc
第二步:安裝必要的基礎軟件,爲安裝codeblocks10.05準備。需要安裝如下軟件:
sudo apt-get install build-essential
sudo apt-get install gdb
sudo apt-get update
sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common
sudo update-alternatives --config wx-config(根據網上文章,選擇2)
sudo apt-get install libgtk2.0-dev
sudo apt-get install libtool
sudo apt-get install autoconf(我在沒有安裝這個時,繼續安裝其它時出了問題)
第三步:以上準備好之後,可以開始使用源代碼安裝了。不過要先下載到源碼包並解壓,下載地址可以是
http://download.berlios.de/codeblocks/codeblocks-10.05-src.tar.bz2
以下是安裝過程
(1)切換到源碼包文件目錄;
(2)依次執行如下命令:
sudo ./bootstrap
sudo ./configure
sudo make
sudo make install
(3)編輯文件/etc/ld.so.conf,將文件內容修改爲
include /etc/ld.so.conf.d/*.conf /usr/local/lib
然後執行命令sudo ldconfig
第四步:修改文件/home/(你的用戶名)/.codeblocks/default.conf,將default.conf改爲任意其它文件,我將它改爲 default.conf.bak。
當以上四步全部完成後就可以運行了,在終端進入到codeblocks所在文件目錄,使用命令./codeblocks。必須注意的是,在進行完第三步之後就開始運行我的出了一個問題,顯示的問題是:
Exception: An exception has been raised!
The application encountered an error at configmanager.cpp, on line 239.
The error message is:
TinyXML error: Error document empty.
In file: /home/r/.codeblocks/default.conf
At row 0, column: 0.