转载自 http://www.binarytides.com/install-wxwidgets-ubuntu/

wxWidgets

wxWidgets is an application development framework/library that allows developer to make cross platform GUI applications for Windows, Mac and Linux using the same codebase.

Its primarily written in C++ but has bindings for other languages as well like Python, Perl and Ruby.

In this tutorial I am going to show you how to compile and build wxwidgets 3.0+ on Debian based linux systems like Ubuntu and Linux Mint.

Compiling wxWidgets from source is not at all difficult as it might sound and takes only a few minutes to do.

The library can be compiled in different modes like static library or dynamic library.

1. Download wxWidgets

The first step would be to download the wxWidgets source files from wxwidgets.org

Once done, extract the files to a directory.

2. Setup build environment

To compile wxwidgets we would need some utility programs including the C++ compiler on Linux called g++. And all of it would be installed from the repositories using apt-get.

We also need the GTK development libraries which wxWidgets depend on.

$ sudo apt-get install libgtk-3-dev build-essential checkinstall
The utility called checkinstall would allow us to create an installation package for wxwidgets, so that later on it can un-installed easily using package managers

3. Compile wxWidgets

Get inside the directory where wxWidgets is extracted. In order to keep things clean, create a directory where the compilation would be done.

$ mkdir gtk-build
$ cd gtk-build/

Now run the configure and make commands one by one. Each one would take some time to finish.

$ ../configure --disable-shared --enable-unicode
$ make

The "--disable-shared" option instructs wxwidgets to builds static libraries instead of shared/dynamic ones.

After the make command finishes, the compilation is done successfully. Its time to install the wxWidgets files to the correct location.

More information about compile options can be found in install.txt and readme.txt files that can be found in /docs/gtk/ inside the wxwidgets directory.

4. Install with checkinstall

Now instead of using the "make install" command, we shall use the checkinstall command to create a deb package for wxwidgets. Run the following command

$ sudo checkinstall

Checkinstall would ask few questions during the process and make sure to provide a version number when asked, otherwise it would fail.

Once the process is over, wxWidgets would be installed and also a deb file would be created in the same directory.

5. Track the installed files

If you wish to check where the files are installed, use the dpkg command followed by the name of the package provided during the checkinstall process.

$ dpkg -L package_name
/.
/usr
/usr/local
/usr/local/lib
/usr/local/lib/libwx_baseu-3.0.a
/usr/local/lib/libwx_gtk3u_propgrid-3.0.a
/usr/local/lib/libwx_gtk3u_html-3.0.a
/usr/local/lib/libwxscintilla-3.0.a
/usr/local/lib/libwx_gtk3u_ribbon-3.0.a
/usr/local/lib/libwx_gtk3u_stc-3.0.a
/usr/local/lib/libwx_gtk3u_qa-3.0.a
/usr/local/lib/libwx_baseu_net-3.0.a
/usr/local/lib/libwxtiff-3.0.a

6. Compile the samples

After compiling wxWidgets, its time to compile the sample programs to see it in action. In the same directory where we compiled wxwidgets, a new subdirectory called samples would have been created.

Just enter it and run the make command

$ compile samples
$ cd samples/
$ make

After the make process finishes, get inside each sample sub directory and there should be an executable file that can be run right away to see the demo.

7. Compile your first program

After you are done with the demo programs, its time to write your own program and compile it. Again it is quite easy.

It is assumed that you are coding in C++ and for that you can use any good editor with syntax highlighting feature. For example gedit, kate, kwrite would do. Or you might want to try fully loaded IDEs like Geany, Codelite, Codeblocks etc.

However for your first program just use an ordinary text editor get it done quick.

Here it is

#include <wx/wx.h>

class Simple : public wxFrame
{
public:
Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
}; class MyApp : public wxApp
{
public:
bool OnInit()
{
Simple *simple = new Simple(wxT("Simple"));
simple->Show(true);
return true;
}
}; wxIMPLEMENT_APP(MyApp);

Now save the program somewhere and compile it with the following commands

# compile
$ g++ basic.cpp `wx-config --cxxflags --libs std` -o program # run
$ ./program

Compiling with non standard libraries

The wx-config command shown above provides only the standard libraries by default. If you are using the Aui classes for example, then you need to specify additional libraries for it

$ g++ code.cpp `wx-config --cxxflags --libs std,aui` -o program

More information can be found here.

Resources

Download source and help files for wxWidgets
https://www.wxwidgets.org/downloads/

wxWidgets wiki page on compile instructions
https://wiki.wxwidgets.org/Compiling_and_getting_started

Notes on how to use the latest wxWidgets version (3.0+)
https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets

Install wxWidgets-3.0.2 on GNU/Linux Debian的更多相关文章

  1. debian7 请把标有“Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 DVD Binary-1 20130615-23:06”的盘片插入驱动器“/media/cdrom/”再按回车键

    有时候,在通过apt-get install 安装软件的时候,会出现: 更换介质:请把标有“Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 DVD B ...

  2. Debian系统中当安装deb软件时出现:deb cdrom:[Debian GNU/Linux 9.3.0 _Stretch_ - Official amd64 DVD Binary-1 20171209-12:11]/ stretch contrib main

    vi /etc/apt/sources.list // 注释掉下面这句话# deb cdrom:[Debian GNU/Linux 9.3.0 _Stretch_ - Official amd64 D ...

  3. (转)完全用GNU/Linux工作 by 王珢

    完全用GNU/Linux工作 王珢      (看完这篇博文,非常喜欢王珢的这篇博客,也我坚定了学gnu/linux的决心,并努力去按照国外的计算机思维模式去学习编程提高自己.看完这篇文章令我热血沸腾 ...

  4. Gnu/Linux的学习探索

    1.Gnu/Linux是一个基于POSIX和UNIX的多用户多任务 支持多线程多CPU的类UNIX的操作系统. 继承了UNIX以网络为核心的设计思想 是性能稳定的多用户网络操作系统. 1991年10月 ...

  5. 下一代GNU/Linux显示服务Wayland 1.12正式发布

    导读 最近,Bryce Harrington很高兴地宣布了“面向GNU/Linux操作系统的Wayland 1.12.0显示服务已正式发布”的消息.与它一同到来的,还有Weston 1.12.0合成器 ...

  6. ZFS(一):ZFS在Debian GNU/Linux上的安装

    以下内容翻译自https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/,并附有原文,由于是第一次翻译,如有任何翻译不恰当之处,欢迎指出 ...

  7. 完全用 GNU/Linux 工作(转)

    转自:http://www.chinaunix.net/old_jh/4/16102.html 看到一半,实在太长,但已觉得很好,转来分享一下. 完全用 GNU/Linux 工作 - 摈弃 Windo ...

  8. 在GNU/Linux下使用Lilypond排版简谱

    尽管GNU/Linux并非无所不能,但确实能在很多时候提供免费.开放的解决方案.这两天我想做一个简谱,在网上搜索乐谱排版软件,发现了基于GPL协议的Lilypond软件.只不过Lilypond是用来做 ...

  9. 我在GNU/Linux下使用的桌面环境工具组合

    为了使GNU/Linux桌面环境下加载的程序较少以节省内存资源和提高启动时间,我目前并不使用重量级的桌面环境KDE和Gnome,甚至连登录窗界面gdm或xdm都不用,而是直接启动到控制台,登录后调用s ...

随机推荐

  1. 微软云平台媒体服务实践系列 1- 使用静态封装为iOS, Android 设备实现点播(VoD)方案

    微软的云平台媒体服务为流媒体服务提供了多种选择,在使用流媒体服务为企业做流媒体方案时,首先需要确认要流媒体接收目标,如针对广大iOS, Android移动设备,由于它们都支持HLS 格式的流媒体,基于 ...

  2. extjs panel自动滚动

    指定两个参数 height:600, autoScroll:true, http://bbs.csdn.net/topics/280012147

  3. Qt的Qss样式

    http://www.cnblogs.com/coffeegg/archive/2011/11/15/2249452.html(转) http://blog.csdn.net/cgzhello1/ar ...

  4. 或许你不知道:ArrayList

    ArrayList 底层以一个transient 线性数组来存储数据,它提供了无参构造方法,和有参构造方法,用户可以通过有参构造方法来初始化长度.如果不传参数,则默认调用无参构造器,数组默认长度为10 ...

  5. .NET-提取字符串实践总结

    前阶段工作时遇到一个截取字符串的问题,由于字符串比较长,大概得几万字符吧(XML形式),要提取中间两个节点之间的内容,在网上费了好大功夫才找到能用的正则.工作当用的时候碰到这样的事最蛋疼了,网上的资源 ...

  6. android开发 图片合成

    private static Bitmap compositeImages(Bitmap srcBitmap,Bitmap dstBitmap){ Bitmap bmp = null; //下面这个B ...

  7. 在C#中使用GDAL创建Shape文件

    这几天在项目中考虑使用GDAL,由于10年没有用过VC了,就在网上搜了下怎么样在C# 中使用GDAL,看到了http://blog.csdn.net/liminlu0314/article/detai ...

  8. setrendertraget 上下颠倒

    这个问题遇到两次了 之前一次是粒子rendertotexture 没设viewprot的时候是上下颠倒的 设置viewport之后就好了 现在在一个setrendertarget的地方又遇到了 上下颠 ...

  9. CRC16校验

    C++中的代码如下:传入字节(byte)数组引用和数组长度 unsigned short CTcpClient::Crc16(const char *pBuf, unsigned short nLen ...

  10. JavaScript原生折叠扩展收缩菜单带缓冲动画

    JavaScript原生折叠扩展收缩菜单带缓冲动画 @落雨 <div id="div_two" style="display: none;"> &l ...