在UBUNTU上安装CodeBlocks的方法(测试可行,解决7.10依赖的问题)

    最近开始玩LINUX,编译器当然必不可少,玩了几天GCC/G++总觉得烦,大概是已经习惯了VS这样的IDE,所以想装个CodeBlocks玩玩,后来碰到不少问题,特别是我的UBUNTU7.10上面的依赖问题,搞半天解决不了,后来GOOGLE了一下找到一些解决方案,下面这个方案最为完整并且能在7.10上解决依赖的问题。原文是E文的,现在翻译成中文贴出来(网上有翻译好的,但是漏掉最关键部分,后面红色标出)

 

原文

Installing Code::Blocks nightly build on Ubuntu

From CodeBlocks

Jump to: navigation , search

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                                        

5. (OPTIONAL) Install the wxWidgets documentation.

            sudo apt-get install wx2.6-doc        

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.

 

 

翻译:

只翻译重要部分,下划线去不掉了,凑合着看吧

 

1.首先安装编译环境及编译器

      sudo apt-get install build-essential

 

2.安装调试工具

      sudo apt-get install gdb

 

如果你在这之前已经装过编译器了那么你可以跳过这两步

 

接下去开始安装wxWidgets,目前CodeBlocks在官方网页上发布的8.02版需要2.8.4以上的wxWidgets支持(此部分不是原文翻译,因为原文可能太过久远提到了某些需要2.6的CB版本,但是现在802版的CB都要2.8.4的WX了,下面直接略过安装2.6的WX的步骤)

 

3.首先备份你的source.list这个文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

 

4.在一个文本编辑器里打开source.list文件并且编辑他

gksudo gedit /etc/apt/sources.list

 

5.在sources.list文件的末尾加入下面的行

deb http://apt.tt-solutions.com/ubuntu/ edgy main

或者

deb http://apt.tt-solutions.com/ubuntu/ feisty main

 

6.保存文件并且关闭你的文本编辑器

 

7.添加tt-solutions.com的KEY

sudo wget http://www.tt-solutions.com/vz/key.asc               

sudo apt-key add key.asc  

重点来了,有些版本的LINUX在你做了上面的步骤以后获取的wxWidgets是2.8.0,然后一会装CB的时候会提示依赖问题需要>=2.8.4以上的WX(目前知道UBUNTU 7.10就有这个问题,而最新的UBUNTU8.04则没有问题),解决方案是:

第五步里添加的东西修改为

deb http://apt.wxwidgets.org/ edgy-wx main

或者

deb http://apt.wxwidgets.org/ feisty-wx main

 

而第七步里的第一个命令改为:

 sudo wget http://apt.wxwidgets.org/key.asc

第二个命令不变

 

8.运行更新命令

sudo apt-get update

原文里第二个更新命令实际不需要

 

9.获取并且安装WX

sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common

 

10.设置WX的默认版本,运行下面的命令随便选一个即可,一般就敲回车用默认值

sudo update-alternatives --config wx-config

 

下面关于获取CB的部分就不原文翻译了,因为会容易导致误解,而且那个地方已经没有最新的FOR LINUX版本提供了,这边直接写怎么装8.02的CB

 

1.从官方网站的下载频道点下载,他提供了两个开源站的下载

给出传送门 http://www.codeblocks.org/downloads/5

选择适合你LINUX版本的下载

 

2.下载过来的tar.gz包解压缩到某个路径下

 

3.在终端下用cd命令转到这个路径

 

4.执行下面的命令安装

sudo dpkg -i *.deb

 

5.安装完成,Enjoy it

 

附送:中文包的安装

1.下载中文包文件

传送门 http://d.download.csdn.net/down/160709/son_of_god

这个不要分的,以后失效的话EMAIL给我,我再传

 

2.复制到你的codeblock路径

在/usr/share/codeblocks/这个路径下新建个叫locale的文件夹,然后把下过来的那个.mo文件拷进去,重新启动你的CB就可以看到中文界面了

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值