Linux平台下开发总结...
在Debian下使用Code::Blocks有一段时间了,但一直没解决如何通过F1打开帮助并查询。类似Windows的方式试过chm格式的帮助文件,但失败了。
近期研究了一下,发现:基于html格式的帮助文件可以这样来实现。
1. Settings->Environment->Help Files.
2. 新增一项,内容为:/home/loaden/Documents/wxDocs/html/wx_$(keyword).html,其中需要将相应的帮助文件解压到对应目录。
3. 设为默认帮助,并在内置的HTML浏览器中打开;
4. 选择将关键词转换为小写。
好了,这样就可以在Linux下使用Code::Blocks的帮助了。
近期研究了一下,发现:基于html格式的帮助文件可以这样来实现。
1. Settings->Environment->Help Files.
2. 新增一项,内容为:/home/loaden/Documents/wxDocs/html/wx_$(keyword).html,其中需要将相应的帮助文件解压到对应目录。
3. 设为默认帮助,并在内置的HTML浏览器中打开;
4. 选择将关键词转换为小写。
好了,这样就可以在Linux下使用Code::Blocks的帮助了。
为了提高编译速度,想把工程支持预编译,然后加入相应选择后却一直没有效果。经查资料,然后还需要设置一下pch.h文件。下面的资料从Code::Blocks的Wiki摘录而来:http://wiki.codeblocks.org/index.php?title=Precompiled_headers
Using precompiled headers (or PCH) speeds up the compilation of large projects (like Code::Blocks itself) by large amounts. This works by creating a header file which #includes all the rarely-changing header files for your project. Then the compiler is instructed to pre-compile this header file. This creates a new file which is now in a binary format that only the compiler understands. But, since it doesn't have to re-parse your header files for every source file that includes them, the process will now be considerably faster.
Using precompiled headers (or PCH) speeds up the compilation of large projects (like Code::Blocks itself) by large amounts. This works by creating a header file which #includes all the rarely-changing header files for your project. Then the compiler is instructed to pre-compile this header file. This creates a new file which is now in a binary format that only the compiler understands. But, since it doesn't have to re-parse your header files for every source file that includes them, the process will now be considerably faster.
利用别名切换wxWidgets库
Linux的命令行拷贝的方法切换不同的库时操作起来比较麻烦,而且/usr/local/bin/wxrc和/usr/local/bin/wxrc-2.8文件无法实现替换。虽然我还不知道这两个文件是干什么用的,但存在就必然有其道理,所以一直感觉很别扭。如何妥善的解决这个问题呢?
很长的命令行输入时很麻烦,还好,通过alias,以别名的方式使得输入命令行的过程即简单又有趣!在这个文件中加入以下几行:
Linux的命令行拷贝的方法切换不同的库时操作起来比较麻烦,而且/usr/local/bin/wxrc和/usr/local/bin/wxrc-2.8文件无法实现替换。虽然我还不知道这两个文件是干什么用的,但存在就必然有其道理,所以一直感觉很别扭。如何妥善的解决这个问题呢?
很长的命令行输入时很麻烦,还好,通过alias,以别名的方式使得输入命令行的过程即简单又有趣!在这个文件中加入以下几行:
gedit ~/.bashrc
alias up='sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo aptget autoclean'
alias sw='sudo pon dsl-provider'
alias dk='sudo poff'
alias up='sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo aptget autoclean'
alias sw='sudo pon dsl-provider'
alias dk='sudo poff'
研究跨平台开发,选择了wxWidgets和Code::Blocks搭挡,那么编译wxGTK和Code::Blocks最新的SVN版本(不选择Code::Blocks 8.02的原因是现在的SVN版本修复了8.02大量BUG,而且使用最新的SVN版本,同时报告使用中出现的问题,本身也是对Code::Blocks开发的支持)就不可避免了。
在Ubuntu下编译,两都都很顺利,但当基于Debian Lenny系统来编译时,CB却出现了问题:
在Ubuntu下编译,两都都很顺利,但当基于Debian Lenny系统来编译时,CB却出现了问题:
codeblocks: error while loading shared libraries: libcodeblocks.so.0: cannot open shared object file: No such file or directory
就是这个错误,导致CB根本无法启动。试着把相应文件拷贝到codeblocks主程序所在的/usr/local/bin目录中(还是Windows的思维),仍然出错。经查找资料,发现此时只要把libcodeblocks.so.0所在的目录加入环境变量中就可以了。sudo /etc/ld.so.conf #编译该文件
/usr/local/lib #将该行加入到该文件的末尾
sudo ldconfig #重新配置
这样就可以正常启动Code::Blocks了。
/usr/local/lib #将该行加入到该文件的末尾
sudo ldconfig #重新配置
在Linux下用 Code::Blocks + wxWidgets + GCC 写跨平台程序,想在源码中包含中文字符,而多语言支持则是以中文为基础,通过*.mo文件翻译。但在编
译时遇到了下面的编译错误:
首先在Code::Blocks的Edit选项中设置Default encoding为Windows 936,然后在全局的编译选项中添加:
译时遇到了下面的编译错误:
converting to execution character set:Invalid or incomplete multibyte or wide character
首先在Code::Blocks的Edit选项中设置Default encoding为Windows 936,然后在全局的编译选项中添加:
-finput-charset=GBK



2008/06/20

