centos codeblocks 安装

来源:互联网 发布:linux tar 压缩文件夹 编辑:程序博客网 时间:2024/06/05 16:41

先安装GTK+

yum install gtk+*

Code::Blocks的界面依赖于wxWidgets,所以需要先安装它,至于wxWidgets是什么可以百度一下,具体我也不清楚。只知道wxWidgets是一个跨平台的GUI库,而在Linux上它依赖于GDK+,GDK+就相当于函数库,所以不用担心它在你的系统中肯定是有的。事实上C::B真正使用的wxWidgets是wxGDK,所以我们首先需要安装的其实是wxGDK库,版本要求大于2.8.0,官方文档说libwxGDK-2.8.3有点问题,所以不推荐。

下载wxGDK:到这里。注意选择wxGTK,我下的是wxGTK-2.8.12.tar.gz。

解压缩:

tar zxf wxGTK-2.8.12.tar.gzcd wxGTK-2.8.12

安装:

复制代码
mkdir build_gtk2_shared_monolithic_unicodecd build_gtk2_shared_monolithic_unicode../configure --prefix=/opt/wx/2.8 \       --enable-xrc \       --enable-monolithic \       --enable-unicodemakesumake installexit
复制代码

安装的路径是/opt/wx/2.8/

设置环境变量:

export PATH=/usr/bin:/opt/wx/2.8/bin:$PATH

然后运行如下命令:

ldconfigsource /etc/profile

 ldconfig命令的作用是让动态链接库为系统所共享,source命令的作用简单来说就是使得配置文件的修改立即生效而不需要重启。


// 如果出现gtk2.0没有安装,则运行下边的程序。

yum -y install gtk2-devel binutils-devel 

安装Code::Blocks

在安装之前还需要先确定一下有没有安装gcc编译器,如果没有yum安装一下,很简单:

yum install gcc-c++

注意:不是yum install g++,我一开始想当然了。下载Code::Blocks(12.11):在这里。我下的是tar包。

解压缩然后依次执行下面的命令:

bootstrap

./bootstrap

bootstrap命令的作用是设置configure脚本及其依赖关系,这个命令只需要执行一次,运行这个命令如果出现下面的错误:

./bootstrap: libtoolize: not found

说明机子上没有安装“libtool”,yum安装下即可:

yum install libtool

可能还会报错:

configure.in:79: warning: macro `AM_OPTIONS_WXCONFIG' not found in libraryconfigure.in:80: warning: macro `AM_PATH_WXCONFIG' not found in libraryconfigure.in:79: error: possibly undefined macro: AM_OPTIONS_WXCONFIG      If this token and others are legitimate, please use m4_pattern_allow.      See the Autoconf documentation.configure.in:80: error: possibly undefined macro: AM_PATH_WXCONFIG

将wxGTK-2.8.12下的wxwin.m4复制到/usr/share/aclocal

cp ../wxwin.m4 /usr/share/aclocal

configure

./configure --with-wx-config=/opt/wx/2.8/bin/wx-config

注意:如果如果wxGDK不是安装在默认的路径这里需要--with-wx-config指定,否则make过程中会提示有error。

接下来安装等待即可:

makemake install4. 安装hunspellyum install hunspellyum install hunspell-devel5. 安装gaminyum install gaminyum install gamin-devel6. 安装gaminyum install boostyum install boost-devel7. 编译并安装Code::Blockstar zxvf codeblocks_13.12-1.tar.gzcd codeblocks-13.12./configure --prefix=/usr --with-contrib-plugins=allmakemake install8. 安装好后,在Application下会出现Programming菜单项,在这里可以启动codeblocks9. 如果出现无法启动的情况,则:编辑这个: /etc/ld.so.conf最后添加: /usr/local/lib然后运行: /sbin/ldconfig10. 如果不出现调试的命令行窗口,则:Settings -> Environment -> General settings -> Terminal to launch console programs ->gnome-terminal --disable-factory -t $TITLE -x11. 取消系统F10菜单键安装gconf-editor: yum install gconf-editor

打开gconf-editor: desktop/gnome/interface/menubar_accel清空

12. 如果有时候无法启动Code::Blocks,则:

vim /etc/ld.so.conf

最后一行添加:/usr/local/lib

保存退出,然后运行/sbin/ldconfig

0 0
原创粉丝点击