codeblocks下图形编程起步

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
关于 codeblocks
上一篇文章转载了 xinlnix 对 code::blocks(以下简称 C::B)的看法,在工程设计的开始, 我也想谈一下自己对应用 C::B 的感受。首先声明,本人也是刚刚接触 C::B,而且也是菜鸟, 呵呵....。
看过几篇关于 C::B 的文章,大多数的使用者都感到 C::B 做得很像微软的 VC,我曾在 windows 环境下用过 VC 和 borland 的 cb,感觉 C::B 这款编译器一部分功能像 VC,而还有一 部分的功能更接近于 borland 的 cb。呵呵...当然,这两款编译器是 windows 下支持 c++的主 流编译器了。C::B 没有像 VC 那样完全遵循类的编程概念,在图形化的支持方面更像 bcb。VC 和 bcb 的很大不同除了一个使用 MFC 类库,一个使用 VCL 类库外,就应该是他们的消息映射 机制了,在这方面 C::B 又有些像 VC 了。这可能也是我在第一次用 C::B 时感到有些奇怪的原 因了,因为总觉着即在用 VC,又在用 bcb。
ubuntu 下 codeblocks 起步
/Q_Jizi/
(一)新一代跨平台 C++开发工具 C:B 简介
Code::Blocks 是一个开放源码的全功能的跨平台 C/C++集成开发环境,目前 1.0 版正在 紧锣密鼓地开发过程中。我们正殷切期待 Code::Blocks1.0 的正式发布,不过当前 1.0revision2220 已经处于绝大部分功能可用状态。
Code::Blocks 支持语法彩色醒目显示,支持代码完成(目前正在重新设计过程中)支持 工程管理、项目构建、调试。
Code::Blocks 支持插件,目前的插件包括代码格式化工具 AStyle;代码分析器;类向导; 代码补全 ;代码统计;编译器选择;复制字符串到剪贴板 ;调试器;文件扩展处理器;Dev-C ++DevPak 更新/安装器;DragScroll,源码导出器,帮助插件,键盘快捷键配置,插件向导; To-Do 列表;wxSmith;;wxSmithMIME 插件;wsSmith 工程向导插件;WindowsXP 外观。
Before we start you will have to compile wxWidgets (or download precompiled binaries and header files). It's described very well on Compiling wxWidgets 2.6.2 to develop Code::Blocks (MSW) or Installing Code::Blocks from source on Windowswiki pages. I may show you how to compile some older versions of wxWidgets, but the same instructions should apply for newer versions.
/wxwidget 支持网站,其中 http: ///manuals/上面有各版本函数手册。
(三)"Hello world" Tutorial
Hi, in this tutorial we will write very basic application that will use wxSmith, called "Hello world". Since this term reflects to the very first step for some coding language, it may also be threated as your first step to learn wxSmith.
Code::Blocks 具有灵活而强大的配置功能,除支持自身的工程文件、C/C++文件外,还支 持 AngelScript 、批处理 、CSS 文件 、D 语言文件 、Diff/Patc h 文件 、Fortan77 文件 、GameMonkey 脚本文件、Hitachi 汇编文件、Lua 文件、MASM 汇编文件、Mathlab 文件、NSIS 开源安装程 序文件 、OgreComposito r 脚本文件、OgreMateria l 脚本文件 、OpenGLShading 语言文件 、Python 文件、Window s 资源文件、XBase 文件、XM L 文件、nVidiac g 文件。识别 Dev-C++工程、MSVS6.0-7.0 工程文件,工作空间、解决方案文件。
If your local wxWidgets copy is ready, let's make some project :) Creating wxWidgets project
The easiest and the preffered way is to create wxWidgest project using project wizard. It stars like creating any other project using New projectmenu:
At the very beginning the wizard asks you which version of wxWidgets you want to use:
On another wizard page you choose what GUI designer will be used and what type of application should be generated:
Code::Blocks 提供了许多工程模板,这包括:控制台应用、DirectX 应用、动态连接库、 FLTK 应用、GLFW 应用、Irrlicht 工程、OGRE 应用、OpenGL 应用、QT 应用、SDCC 应用、SDL 应用、SmartWin 应用、静态库、Win32GUI 应用、wxWidgets 应用、wxSmith 工程,另外它还 支持用户自定义工程模板。在 wxWidgets 应用中选择 UNICODE 支持中文。
When you use global variable for the first time, it will ask for wxWidgets directory. The only thing you need to do here is to enter valid location in basefield. This is required only for the first time since Code::Blocks will automatically use this setting for other projects you create.
C::B 在功能方面虽还比不上 VC 和 bcb,但也是一款不错的 c++编译器。他即可在 windows 下又可在 linux 下使用,这是一个很大的优点。开发的程序移植性差,不能跨平台一直是我 们感到一个很郁闷的问题。Windows 平台下的优秀 GUI 程序很多,Unix、Linux 无疑比较欠缺。 而日常以 Linux 平台作为工作环境,也比较困难。因为 windows 在多媒体能力方面无疑更为 强大,内容也更为丰富。C::B 无疑为我们提供了一个解决这个问题的途径。
相比于 QTdesigner 这类界面设计工具而言,Code::Blocks 是完整的开发环境;相比于基 于 Delphi 的 Dev-C++共享 C++IDE,Code::Blocks 是开放源码软件。Code::Blocks 由纯粹的 C++语言开发完成,它使用了蓍名的图形界面库 wxWidgets(2.6.2unicode)版。对于追求完美 的 C++程序员,再也不必忍受 Eclipse 的缓慢,再也不必忍受 的庞大和高昂的价格。
C::B 现在虽还处于起步阶段,大部分有关资料都还是英文版本,但已受到了很多人的关 注,也让我们拭目以待,关注这款 IDE 的发展。
code::blocks 有关网站:
/C::B 的官方网站
/C::B 官网论坛
Code::Blocks 基于 wxWidgets 开发,正体现了 wxWidgets 的强大。以前 BorlandC ++BuilderX 宣称基于 wxWidgets 开发跨平台、兼容性好、最优秀的 C++IDE 环境,但没有实 现;现在 Code::Blocks+GNUGCC 正在实现这个理想。让我们拭目以待。国内的 Code::Blocks 爱好者和跨平台开发员应该尽快建立中文 Code::Blocks 网站,提供 Code::Blocks 中文化支 持,促进 Code::Blocks 在国内的发展。
Then to create wxWidgets application, let's choosewxWidgets icon:
After you click "Go" button, Code::Blocks will bring up the wizard window. It consist of several pages where you can enter some options for your project. I'll describe few pages better since they may cause problems for new users.
On another page you may choose the location of your wxWidgets library:
You can choose real directory here, but that may lead to problems when your project should also compile on other computers. Another choice is to use Global Variable system availabie in Code::Blocks. When you use it, the location of wxWidgets library is read from such variable. This mean that wxWidgets directory is not hard-coded inside your project, but is stored inside global configuration of Code::Blocks. When your project will be opened on other computer, it will use it's configuration. The easiest option to use global variable is to leave $(#wx)what means to use global variable named wx. This name is reserved for wxWidgets and should be choosen in most cases.
虽然 Code::Blocks 从一开始就追求跨平台目标,但是最初的开发重点是 Windows 系统下 的版本,从 06 年 3 月 21 日版本:1.0revision2220 开始,Code::Blocks 在它的每日构建中 正式提供 Linux 版本(分两个版本:ubuntu.deb 和 fc4.rpm)。这样 Code::Blocks 在 1.0 发 布时就会是跨越平台的 C/C++IDE,它将支持 Windows 和 Linux 的主要版本。长期以来 C++开 发员在 Linux 没有好用、通用的 C++IDE 的局面就要结束。而这个 IDE 对于 Windows 下的用户 同样重要,由于它开放源码的特点,Windows 用户可以不依赖于 ,编写跨平台 C++应 用。
相关文档
最新文档