BeanJoy 2012-09-24
1.Ubuntu 12.04中没有了新立德,忍受不了软件中心的慢,所以安装了新立德
apt-get install synaptic
2.安装gcc等C/C++编程相关工具
sudo apt-get install build-essential
3.安装gtk+(opencv的界面显示就靠它了)
安装GTK环境只要安装一个libgtk2.0-dev就可以了,而安装gnome开发环境的话,需要装gnome-core-devel,它包含GTK开发包。
sudo apt-get install gnome-core-devel(有点慢,需要下载,看网速)
pkg-config --modversion gtk+ (查看1.2.x版本)
pkg-config --modversion gtk+-2.0 (查看 2.x 版本)
pkg-config --version (查看pkg-config的版本)
pkg-config --list-all |grep gtk (查看是否安装了gtk)
4.使用synaptic安装cmake-qt版本
有界面的cmake配置opencv编译选项方便些
5.安装wxWidgets(codeblocks IDE需要到)V2.8
由于codeblocks是用wxWidgets开发的,所以wxWidgets需要先安装.以最小化体积为编译目的,shared,unicode版本,库文件编译为一个文件,不支持2.8,去掉debug信息,最终配置命令如下(./configure --help可查看参数信息):
./configure --enable-unicode --enable-shared--enable-monolithic --disable-compat28 --disable-debug_flag
make(需要一定时间)
make install
ldconfig(需要把/usr/local/lib加到/etc/ld.so.conf最后一行中,再执行ldconfig)
编译后的文件放在/usr/local/bin和/usr/local/lib目录中,可通过—prefix改变路径.
由于Codeblocks暂时只支持2.8,所以卸载2.9的:make uninstall.重新安装2.8
./configure --enable-unicode --enable-shared--enable-monolithic --disable-compat26 --disable-debug_flag
make(需要一定时间)
make install
6.安装CodeBlocks(Ver10.05)
Codeblocks最新版本10.05(截至2012-5-12)只能使用wxWidgets2.8,不兼容2.9.使用2.9会出现以下错误:editarrayorderdlg.h:20:error: default argument for parameter of type 'const wxArrayString&' hastype 'long int'. 且wxWidgets需编译成单一文件.源代码下的BUILD文件里面有编译说明.直接顺序执行以下三条命令就行.
./configure --with-contrib-plugins=all
make
make install
安装完成后,打开它只发现它在任务栏中闪一会儿就消失了,出不了界面.在终端得运行提示:codeblocks:error while loading shared libraries: libcodeblocks.so.0: cannot open sharedobject file: No such file or directory
解决办法为:In that case make sure the library path where the Code::Blocks librarieswhere installed into is "known" to the system. For example: On Ubuntuusing a default build process on a clean system will install the Code::Blocksexecutables to /use/local/bin and the libraries to /usr/local/lib. The latteris usually not known to a "clean" Ubuntu system. To add it to thesearch path for libraries do the following (as root / using sudo respectively):Add the following line to the file /etc/ld.so.conf:
/usr/local/lib
...and run:
ldconfig
That's it - Code::Blocks should now work just fine asall libraries are being found.
wxSmith用不了,打开CB提示:
/usr/local/lib/codeblocks/plugins/libwxSmithAui.so:not loaded (missing symbols?)
/usr/local/lib/codeblocks/plugins/libwxsmithcontribitems.so:not loaded (missing symbols?)
/usr/local/lib/codeblocks/plugins/libwxsmith.so: notloaded (missing symbols?)
运行 sudo ldconfig就行