转载https://blog.csdn.net/ztguang/article/details/51015587 + 个人遇见的新问题
在CentOS7上安装Codelocks的过程。
1.安装gcc,需要c和c++两部分,默认安装下,CentOS不安装编译器的,在终端输入以下命令即可
yum install gcc
yum install gcc-c++
2.安装gtk2-devel,因为默认已经安装了正式产品需要的支持库,但是没有安装开发所需要的文档.
yum install gtk2*
3. 安装wxGTK(或者wxwidgets),下载地址:http://www.wxwidgets.org/downloads/,下载的文件为:wxWidgets-3.0.2.tar.bz2,
解压之后,进入目录后执行命令
./configure --enable-xrc --enable-monolithic --enable-unicode
make -j5
make install
------------------------------------------------------
The installation of wxWidgets is finished. On certain
platforms (e.g. Linux) you'll now have to run ldconfig
if you installed a shared library and also modify the
LD_LIBRARY_PATH (or equivalent) environment variable.
wxWidgets comes with no guarantees and doesn't claim
to be suitable for any purpose.
Read the wxWindows Licence on licencing conditions.
------------------------------------------------------
ldconfig
4. 安装codeblocks,下载codeblocks安装包,下载地址:http://www.codeblocks.org/downloads/
这里有两种方式进行安装:
第一种方式是直接下载rpm包,可以直接进行安装,但是rpm安装形式,没有默认安装可视设计wxsmith。
第二种方式是下载源代码包,后缀为.tar.gz(.tar.bz2),下载之后,解压缩,进入目录,执行命令
./configure --prefix=/codeblocks --with-contrib-plugins=all
(如果只是./configure那默认情况是不会安装可视设计wssmith,如果不需要图形界面开发的话可以直接使用第一种安装方式)
-------------------------------------------------------------------------------
checking for GTK2... yes
checking for GAMIN... no
configure: error: Package requirements (gamin) were not met:
No package 'gamin' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables GAMIN_CFLAGS
and GAMIN_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-------------------------------------------------------------------------------
解决上面问题的方法: yum install gamin*
make -j5
如果make不过出现 “ fatal error: boost/spirit/include/classic.hpp: No such file or directory”字样,需要安装boost,运行
yum install boost
yum install boost-devel
yum install boost-doc
然后:
make install
[root@localhost bin]# pwd
/codeblocks/bin
[root@localhost bin]# ./codeblocks
./codeblocks: error while loading shared libraries: libwx_gtk2u-3.0.so.0: cannot open shared object file: No such file or directory
----------------------------------------
vim /etc/ld.so.conf
最后一行添加:/usr/local/lib
保存退出,然后运行 ldconfig 即可。
----------------------------------------
[root@localhost bin]# ln -s /codeblocks/bin/codeblocks /root/桌面/codeblocks