64位centOS 5.3下编译安装codeblocks
December 11, 2009 – 12:11 am上学的时候编译C++程序使用Microsoft Visual C++,现在转到linux下,自然就不能用那个了,虽然vim + gcc可以搞定一切,但是为了最大程度得提高开发效率,安装一个IDE是必须的。codeblocks是再好不过的选择了。
codeblocks官方没有提供基于centos的发行版本,所以只好选择源代码编译安装了,下载地址:http://www.codeblocks.org/downloads
- bunzip2 codeblocks-8.02-src.tar.bz2
- tar xvf codeblocks-8.02-src.tar
- cd codeblocks-8.02
- ./configure --prefix=/opt/codeblocks8.02
提示错误如下:
- checking for wx-config... no
- configure: error:
- wxWidgets must be installed on your system.
- Please check that wx-config is in path, the directory
- where wxWidgets libraries are installed (returned by
- 'wx-config --libs' or 'wx-config --static --libs' command)
- is in LD_LIBRARY_PATH or equivalent variable and
- wxWindows version is 2.8.0 or above.
解决方法,下载http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.8.10.tar.gz,然后编译安装。
- tar zxvf wxGTK-2.8.10.tar.gz
- cd wxGTK-2.8.10
- ./configure --prefix=/usr
提示错误如下:
- checking for GTK+ - version >= 2.0.0... no
- *** Could not run GTK+ test program, checking why...
- *** The test program failed to compile or link. See the file config.log for the
- *** exact error that occured. This usually means GTK+ is incorrectly installed.
- configure: error:
- The development files for GTK+ were not found. For GTK+ 2, please
- ensure that pkg-config is in the path and that gtk+-2.0.pc is
- installed. For GTK+ 1.2 please check that gtk-config is in the path,
- and that the version is 1.2.3 or above. Also check that the
- libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
- --libs' are in the LD_LIBRARY_PATH or equivalent.
解决方法:
- yum install gtk2-devel
再次
- ./configure --prefix=/usr
完成后提示信息如下:
- configure: creating ./config.status
- config.status: creating Makefile
- config.status: creating expat_config.h
- Configured wxWidgets 2.8.10 for `x86_64-unknown-linux-gnu'
- Which GUI toolkit should wxWidgets use? GTK+ 2
- Should wxWidgets be compiled into single library? no
- Should wxWidgets be compiled in debug mode? no
- Should wxWidgets be linked as a shared library? yes
- Should wxWidgets be compiled in Unicode mode? no
- What level of wxWidgets compatibility should be enabled?
- wxWidgets 2.4 no
- wxWidgets 2.6 yes
- Which libraries should wxWidgets use?
- jpeg sys
- png sys
- regex sys
- tiff builtin
- zlib sys
- odbc no
- expat builtin
- libmspack no
- sdl no
继续
- make
- 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 wxWidgets Licence on licencing conditions.
我们继续回去编译安装codeblocks
- ./configure --prefix=/opt/codeblocks8.02
- make
- make install
现在启动codeblocks开始我们的C++编程之旅了。