转载自 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. virtualbox下 ubuntu 14.04设置外网独立IP

    安装时记得选择sshserver vim /etc/network/interfaces iface eth0 inet static address YOUR IP netmask 子网掩码 get ...

  2. OSGi在淘宝内部的使用

    现在基本不怎么用了,OSGi主要的价值,在实际中体现得不太明显 比如类隔离,用更简单的自定义ClassLoader也可以实现:单机多版本服务,用的场景也很少:热部署也不是很实用 但是,基于OSGi框架 ...

  3. oc中对象的初始化

    在.m文件中使用对象方法: - (id)init { _name =@"zhangsan"; _age = 18; return self; } 然后通过main方法中进行创建对象 ...

  4. Python实现ID3(信息增益)

    Python实现ID3(信息增益) 运行环境 Pyhton3 treePlotter模块(画图所需,不画图可不必) matplotlib(如果使用上面的模块必须) 计算过程 st=>start: ...

  5. Actionform

    Actionform 2013年7月8日 15:08 Reset 用actionform是把数据恢复到初始状态 Getter/setter Validate 验证 已使用 Microsoft OneN ...

  6. OC中数组类NSArray的详解,数组的遍历(二)

    数组类的便利 1.for循环(大家都会的...) 2.NSEmunerator 3.for in 首先重点说下 第二种NSEmunerator枚举器,系统声明是 @interface NSEnumer ...

  7. [shell基础]——split命令

    测试文本 # cat name1.txt name1 alvin1 name2 alvin2 name3 alvin3 name4 alvin4 此时目录下就只有这个文件 # ls name1.txt ...

  8. cocos2dx 3.x中的渲染机制

    1.由2.x的渲染节点,变成添加渲染命令,可以避免重复渲染相同的节点,提高了渲染效率 2.单机游戏通常要求apk包在30M以内,没压缩1M会有1%的转换率(下载转换率),即收入会提高 3.2.x中首先 ...

  9. JPA学习---第十节:JPA中的一对一双向关联

    1.创建实体类,代码如下: 代码清单1: package learn.jpa.entity; import javax.persistence.CascadeType; import javax.pe ...

  10. Leetcode-Construct Binary Tree from inorder and preorder travesal

    Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that ...