CentOS下安装Code::Blocks

Linux下c++编程有很多工具选择,vim是一款广受大神欢迎的编辑器,但上手难度也大。我是IDE的爱好者,自然选择喜欢的IDE,于是装了简单易用的code::blocks。下面是安装教程。

vim和IDE没有孰优孰劣,开发效率高,能熟手使用就是好东西。


工具介绍

目前最新版本 codeblocks_17.12.tar.xz   http://www.codeblocks.org/downloads/source

对应wxWidgets版本是wxWidgets-3.0.4(20MB)  https://www.wxwidgets.org/downloads/

codeblocks是基于wxGTK的图形工具,安装依赖关系如下:
Code::Blocks -> wxWidget (> libwxGTK2.8) -> GTK+ (> libgtk-x11-2.0) -> X
意思是先安装x11-2.0版本以上的GTK+,再安装GTK2.8以上内核的wxWidget,然后安装3.0.4版本的code::blocks。

官方给出了所有Linux版本的安装引导,里面描述了大部分安装过程可能遇到的问题,
http://wiki.codeblocks.org/index.php/Installing_Code::Blocks
链接里说了如果是纯净Linux环境下,安装codeblocks需要用到的工具。通常系统都自带了这些和GTK+,CentOS查看GTK+命令

rpm -qa | grep gtk

如果能看到gtk2-devel字样,就是装了,没有的请自行安装 。

安装wxWidget

下载wxWidgets-3.0.4并解压

# 进入wxWidgets目录
cd wxWidgets-3.0.4/

# 配置属性
./configure --prefix=/usr --enable-xrc--enable-monolithic --enable-unicode

# 执行make
make

# 执行安装
make install

make的过程有好几分钟。如果没有Makefile文件生成,多半是缺了依赖工具。

安装Code::Blocks

下载codeblocks_17.12.tar.xz,解压并安装。安装过程挺长的,用了10分钟左右。

# 解压文件
xz -d codeblocks_17.12.tar.xz 
tar xvf codeblocks_17.12.tar

# 进入目录
cd codeblocks-17.12

# 设置配置脚本及依赖,只需运行一次。可能会遇到"问题1"
./bootstrap

# 配置时指定目录并安装插件。可能会遇到"问题 2 3 4"
./configure --prefix=/usr --with-contrib-plugins=all

# 编译
make
# 安装
make install

问题1 ./bootstrap: line 66: libtoolize: command not found

yum install libtool -y

问题2 checking for HUNSPELL... configure: error: Package requirements (hunspell) were not met:

yum install hunspell -y
# However: Package hunspell-1.2.8-16.el6.i686 already installed and latest version
# yum list installed hunspell*,已经安装有了。
yum install hunspell-devel -y

问题 3 checking for GAMIN... configure: error: Package requirements (gamin) were not met:

yum install gamin gamin-devel -y

问题4 configure: error: needed boost headers not found or not usable

yum install boost boost-devel -y

配置lib路径

因为是自定义安装的软件,需要把lib路径添加到 ld.so.conf

vim /etc/ld.so.conf

# 添加这句话
>> ...
>> /usr/lib/codeblocks/

# 更新配置
lbconfig

上述步骤在安装Code::Blocks设定了 --prefix=/usr,lib路径会默认在/usr/lib/codeblocks
如果用其他路径,可用 find / -name codeblocks查看lib的位置。

打开Code::Blocks

根据安装目录的bin位置打开

/usr/bin/codeblocks

也可在菜单打开 应用程序>>编程>>Code::Blocks,如果没有生成菜单,打开目录

/usr/share/applications 

看codeblocks.desktop是否存在,若存在的,重启就能看到菜单;若不存在,请手动添加如下再重启:

[Desktop Entry]
Version=1.0
Type=Application
Name=Code::Blocks IDE
GenericName=Intergrated development environment
Comment=Configurable and extensible IDE
Exec=codeblocks %F
Icon=codeblocks
Terminal=false
X-MultipleArgs=true
Categories=Development;IDE;GTK;
StartupNotify=true
MimeType=application/x-codeblocks;application/x-codeblocks-workspace;  

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值