Code::Blocks是一個開源的跨平臺的C/C++的IDE,和VC++系列的IDE非常類似,這對于從windows下轉(zhuǎn)型到
Linux的用戶是一個非常不錯的選擇。windows下早就安裝過了,體驗之后非常不錯,雖然和vc不能相提并論,但是在linux下面能夠使用到這么
強(qiáng)大的IDE已經(jīng)非常了不起了。那么開始把,本人的系統(tǒng)是ubuntu8.04,幾經(jīng)周折,終于成功完成。(來自csdn的
xugang_2001)
開始到處google資料,最后嘗試N次之后才發(fā)現(xiàn),官方就有CB的安裝方法,具體鏈接在wiki上:
這個因為是國外網(wǎng)站打開速度可能比較慢,我就替大家貼出來吧:
Installing Code::Blocks nightly build on Ubuntu
From CodeBlocks
This
is a quick guide to get Code::Blocks up and running on your Ubuntu
based Linux distribution. It is also going to make sure you can develop
wxWidgets applications on your box as well. Look at the bottom of this
guide for a complete command line that will install all the packages in
one operation.
First be sure you have the necessary software to compile and debug programs.
1. Install the compiler.
sudo apt-get install build-essential
2. Install the debugger.
sudo apt-get install gdb
You'll need to install wxWidgets to use Codeblocks. Revisions prior
to revision 4051 use wxWidgets 2.6 and revisions from 4051 and after
use wxWidgets 2.8.4. If you want to install a revision prior to
revision 4051, make sure you have your universe and multiverse repositories enabled and install the following packages.
3. Install wxWidgets library. (This package is all that is needed to run any application that uses wxWidgets. ie. Code::Blocks)
sudo apt-get install libwxgtk2.6-0
4. Install the wxWidgets developement packages. (This is used to develop wxWidgets applications of your own.)
sudo apt-get install libwxgtk2.6-dev wx2.6-headers wx-common
(注:上面2個步驟非常重要,缺了gtklib后面的deb包安裝就會失敗)
5. (OPTIONAL) Install the wxWidgets documentation.
sudo apt-get install wx2.6-doc
(注:在下載wxWidgets系列庫的時候其實可以直接使用新立得軟件更新包管理器來
搜索wxWidgets字眼,然后從當(dāng)中的列表中選擇最新的庫來裝.直接選就可以省掉上面一對麻煩的命令,其實上面的幾個步驟無非就是完成libgtk庫
和wxWidgets相關(guān)庫的安裝,這在新利得上搜索wxWidgets很容易選擇。)
To install wxWidgets 2.8.4 you need to be using Ubuntu 6.10
(Edgy Eft) or Ubuntu 7.04 (Feisty Fawn) and you need to add the
wxWidget repository to your sources.list. You can install wxWidgets 2.8.4 on Ubuntu 6.06 (Dapper Drake), but the nightly builds are not made to run on Dapper.
1. Backup your current sources.list first for precaution.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2. Open your sources.list in a text editor to edit it.
gksudo gedit /etc/apt/sources.list
3. Add the correct repository for the Ubuntu version you are running to the end of the file. The repository listed below is referenced on the wxWidgets.org download page and appears to be for the stable version.
deb http://apt.tt-solutions.com/ubuntu/ edgy main
or
deb http://apt.tt-solutions.com/ubuntu/ feisty main
4. Save and close the file.
5. Add the key for tt-solutions.com.
sudo wget http://www.tt-solutions.com/vz/key.asc
sudo apt-key add key.asc
Alternate wxWidgets repository.
Some users of Code::Blocks have received critical errors related to
libwxgtk when using the above repository packages. They were able to
solve their problems by installing newer packages available from an
alternate repository from wxWidgets.org. To use these packages make the
following changes to the above directions:
Add deb http://apt.wxwidgets.org/ edgy-wx main or deb http://apt.wxwidgets.org/ feisty-wx main to your sources.list.
Download the gpg key using wget http://apt.wxwidgets.org/key.asc and install the same as above.
6. Update your sources.list and run upgrade to make sure everything is up-to-date.
sudo apt-get update
sudo apt-get dist-upgrade
7. Now you're finally ready to install wxWidgets 2.8.4.
sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common
8. Set wxWidgets 2.8 as default version for your machine. Select number for the wxgtk2.8 version.
sudo update-alternatives --config wx-config
Now go get the nightly build and install it. All dependencies should now be met.
1. Get the latest nigtly build of Code::Blocks from the nightly builds forum.
2. Install Code::Blocks.
sudo dpkg -i <Name_Of_Daily_Build.deb>
NOTE: Since revision 4281 and after, the nightly builds are
made differently. Codeblocks is now packaged into separate Debian
packages and the packages are archived together in a tar.gz file.
(編
者注:其實所謂的nightly
build版本只是在version4281之前才有效,后來的的版本是不需要下載所謂的nightly&&deb版本,直接到官方網(wǎng)站下載deb包,里
頭有6個小包,直接使用后面的dpkg -i *.deb就可以了。這里頭千萬別被nighlt弄混了,直接無視就是了。)
1. Download the tar.gz file to your computer and extract the files to an empty directory, such as one called temp for example.
tar xvf CB_date-of-build_revision-number_Ubuntu6.10+7.04_wx2.8.4.tar.gz
(編者注:這里只是解壓deb的命令,也可以直接在IDE上右鍵選擇“解壓縮到此處。。。”即可)
2. Install all the packages at the same time.
sudo dpkg -i *.deb
(注:大功告成的語句)
The packages can be installed individually, if you prefer not to
install everything. The first package to install is libcodeblocks0
followed by the codeblocks package. All the other packages are
optional. If you want to install the wxsmith and/or contrib packages,
you must install the libwxsmithlib0 package first.
NOTE: Here is a complete command line for the above steps. Watch for word wrap. Replace wx2.6 with wx2.8 when needed.
(編者注:這里只是提供一個替換wx2.6到最新版(目前為止)2.8時的命令)
sudo apt-get install build-essential gdb libwxgtk2.6-0 libwxgtk2.6-dev wx2.6-headers wx2.6-doc wx-common
Without optional steps:
sudo apt-get install build-essential gdb libwxgtk2.6-0 libwxgtk2.6-dev wx2.6-headers wx-common
也許大家要問了,如果是想自己用源碼從頭到尾進(jìn)行編譯怎么辦?我這里也有一個解決方案,
原理和步驟基本上和上文類似,大家可以參考一下:
1. Linux平臺下編譯安裝wxGTK(以wxGTK-2.6.2 為例)
下載wxGTK-2.6.2.tar.gz(http://www.wxwidgets.org/)
tar zxvf wxGTK-2.6.2.tar.gz
cd wxGTK-2.6.2
./configure --enable-xrc --enable-monolithic --enable-unicode
make
make install
vi /etc/ld.so.conf
將/usr/local/lib加入后,運(yùn)行l(wèi)dconfig
可以通過以下操作的輸出檢查安裝是否正確
wx-config --prefix
wx-config --libs
which wx-config
2.下載Code::Block
通過svn+http下載code::blocks
安裝subversion,在 .subversion/servers 文件的global段設(shè)置代理服務(wù)器
svn checkout http://svn.berlios.de/svnroot/repos/codeblocks/trunk
如果不需要設(shè)置代理服務(wù)器,則可以用
svn checkout svn://svn.berlios.de/codeblocks/trunk
直接下載代碼
3.編譯安裝Code::Block
直接運(yùn)行bootsrtap可能會遇到宏AM_PATH_WXCONFIG 沒定義等錯誤
1) cp /usr/local/share/aclocal/wxwin.m4 /usr/share/aclocal/wxwin.m4
2)./bootstrap
./configure
make
make install
至此全部ok了 經(jīng)測驗第一種方法完全可行,并且在我的Ubuntu8.04上順利啟動,哈哈,Ejoy it!
http://blog.csdn.net/xugang_2001/archive/2008/11/05/3230598.aspx