您的位置:首页 > 运维架构

在openSUSE11.0操作系统下安装与使用codeblocks10.5

2011-10-01 20:59 357 查看
一、从http://www.wxwidgets.org/downloads/下载wxGTK2.8.12;
把wxGTK-2.8.12.tar解压到/home/wxGTK-2.8.12目录中,按照下列几步即可完成编译和安装:

a)、#./configure

b)、#make 编译wxGTK-2.8.12程序

c)、#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.

------------------------------------------------------

d)、#make uninstall 如果要卸载安装的程序,用此命令即可

编译时需要一段时间,请耐心等待!安装之后需要把该共享库配置LD_LIBRARY_PATH

环境变量中来。打开/etc/profile文件,在最后添加如下项:

LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH

#source profile 在控制台键入该生效命令

wxWidgets介绍:

wxWidgets is a C++ library that lets developers create applications for
Windows, OS X, Linux and UNIX
on 32-bit and 64-bit architectures as well as several mobile platforms including Windows Mobile, iPhone SDK and embedded GTK+. It has popular language bindings for
Python,
Perl, Ruby and many other languages. Unlike other cross-platform toolkits, wxWidgets gives its applications a truly native look and feel because it uses the platform's native API rather than emulating the GUI.
It's also extensive, free, open-source and mature. Why not give it a try, like
many others have?

二、从http://www.codeblocks.org/downloads下载codeblocks-10.05-0-suse112.src.rpm

把codeblocks-10.05-0-suse112.src.rpm解压到/home/codeblocks-10.05-0-suse112目录中,方法同上面操作过程类似,按照下列几步即可完成编译和安装:

a)、#./configure

b)、#make 编译codeblocks-10.05-0-suse112程序

c)、#make install 安装的程序

d)、#make uninstall 如果要卸载安装的程序,用此命令即可

编译时需要一段时间,请耐心等待!

codeblocks介绍:

Code::Blocks是一个免费、开源、跨平台的IDE,使用C++开发,并且使用wxWidgets做为GUI函式库。Code::Blocks使用了插件架构,其功能可以使用插件自由地扩充。目前, Code::Blocks主要针对开发C/C++程式而设计。Code::Blocks目前支援Windows、Linux及Mac OS X数种平台。使用者亦能够在FreeBSD环境中建设Code::Blocks

三、测试程序编写

工要善其事,必须利其器。我们做事之前要先把一件要做的事件搞清楚,它的内部有哪些特性,这些功能如何操作,是否与其它事物有相互联系之处等。如果这些您都熟悉和了解透彻了,我想您基本掌握该工具了。工具就是让人操作的,要发挥它所有的功能,聪明的您要给它解剖了。

A、 动态库的使用

1、创建新项目Shared library



2、执行“go”命令,出现下面的画面



3、选择C++作为编译器



4、设置工程目录,这里我们有codeblocks、linux、vxworks和win32目录,inc存放*.h文件,src存放*.cpp。



5、设置工程对象文件(*.o)及*.so拷贝输出的目录



6、添加工程文件*.h



7、添加工程文件*.cpp



8、添加代码之后的工程目录



9、工程编译设置



10、工程*.so输出设置



A、 应用程序的使用

1、创建工程console application



2、设置工程目录



3、工程引用头文件目录



4、工程引用库文件目录

本文按照常规方法添加动态库资源,设置方法与makefile文件保持一致性,以致我们能用常见的方法统一管理。



5、工程输出文件设置



6、工程编译,下面图形是工程加载文件后项目树



7、工程调试



7、执行结果



这里创建两个典型的工程,使用codeblocks集成开发环境,让您更便捷地调试工程,而不必通过printf盲调了,有了这个集成开发环境,我们何乐而不为呢?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: