转载自 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. python中有趣的函数

    filter(function, sequence):对sequence中的item依次执行function(item),将执行结果为True的item组成一个List/String/Tuple(取决 ...

  2. java判断某个字符串包含某个字符串的个数

    /** * 判断str1中包含str2的个数 * @param str1 * @param str2 * @return counter */ public static int countStr(S ...

  3. json 读写 swift

    // // ViewController.swift // json读写 // // Created by mac on 15/7/14. // Copyright (c) 2015年 fangyuh ...

  4. 【工作总结】LLDB调试技巧 - 篇一

    备忘命令 : 命令“l”可以查看程序当前运行的位置 (lldb) l } - (void)rightBarButtonAction { 命令“bt”也能查看程序运行的调用栈 (lldb) bt * t ...

  5. mysql安装/启动报错汇总

    2016/9/6补充 初始化报错: # /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysq ...

  6. VC++ MFC 如何实现在编辑框中输出具有换行功能的文段 01

    很久不来写东西了,昨天睡觉前写个小工具,突然,这玩意不会换行怎么整... 首先是第一步,获取字符串的长度,转载自白乔的文章. ------------------------------------- ...

  7. c++中-1是true呢还是false呢

    今天想看一下引用c++中的,然后看到网上有问c++中-1是true or false呢?用vc6.0是了一下,是true.vc6.0中应该是非0的都是true,0为false.java我也试了一下,i ...

  8. Node.js 学习(五)Node.js 事件循环

    Node.js 是单进程单线程应用程序,但是通过事件和回调支持并发,所以性能非常高. Node.js 的每一个 API 都是异步的,并作为一个独立线程运行,使用异步函数调用,并处理并发. Node.j ...

  9. STL容器的适用情况

     转自http://hsw625728.blog.163.com/blog/static/3957072820091116114655254/ ly; mso-default-props:yes; m ...

  10. 请实现一个函数用来找出字符流中第一个只出现一次的字符。例如,当从字符流中只读出前两个字符"go"时,第一个只出现一次的字符是"g"。当从该字符流中读出前六个字符“google"时,第一个只出现一次的字符是"l"。

    // test20.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #include< ...