Install wxWidgets-3.0.2 on Gnu/linux Debian

Source: Internet
Author: User
Tags gtk wxwidgets linux mint

Reprinted from http://www.binarytides.com/install-wxwidgets-ubuntu/

WxWidgets

WxWidgets is a application development framework/library that allows developer to make cross platform GUI applications fo R Windows, Mac and Linux using the same codebase.

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

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

Compiling wxWidgets from source are 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 is 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 is 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 a installation package for wxwidgets, so this 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 is 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 are done successfully. Its time-to-install the WxWidgets files to the correct location.

More information about compile options can is found in Install.txt and Readme.txt files, can be found in/docs/gtk/in Side 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 Wxwidge Ts. 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 was 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 is installed, use the dpkg command followed by the name of the package provided Duri ng 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 the IT in action. In the same directory where we compiled wxwidgets, a new subdirectory called samples would has 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 is an executable file the can is R Un right away-see the demo.

7. Compile Your first program

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

It is assumed, that's coding in C + + and for that, 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 the text editor get it done quick.

Here it's

#include <wx/wx.h>class simple:public wxframe{public: Simple    (const wxstring& title): Wxframe (NULL, Wxid _any, title, Wxdefaultposition, Wxsize (+)) {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 is using the Aui classes for example and then your need to specify additional libraries for it

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

More information can is 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.