http://blog.csdn.net/yuzhenxiong0823/article/details/7727133wxwidgets under Linux have WXGTK and wxX11 for use, each need GTK and X11 development environment;
Wxwidgets has WXGTK and wxX11 for use under Linux, but the GTK and X11 development environments need to be configured separately, and the development environment is configured as follows:
X11 installation (if you choose to use wxX11):
Apt-get Install Libx11-dev
GTK Installation (if you choose to use WXGTK):
Apt-get Install Gnome-core-devel #这将安装 Libgtk2.0-dev Libglib2.0-dev and other development-related library files
In the www.wxwidgets.org download WXGTK or wxX11, this is the Wxwidgets library, the following is the compilation method, in WXGTK for example:
TAR-ZXF wxgtk-2.8.11.tar.gz
CD wxGTK-2.8.11
./configure
Make
sudo make install
sudo ldconfig
Enter Wx-config--cxxflags to check if WXGTK is properly configured for installation
If you can see the path to the Wx-config header file, the configuration is successful.
Let me give you an example of how to compile the WXGTK program using Wx-config
Hello.cpp content is as follows:
#include "wx/wx.h"
Class Helloworldapp:public Wxapp
{
Public
virtual bool OnInit ();
Private
Wxbutton *button;
};
Implement_app (Helloworldapp)
/* Executed upon startup, like ' main () ' in non-wxwidgets programs */
BOOL Helloworldapp::oninit ()
{
Wxframe *frame = new Wxframe ((wxframe*) NULL,-1, _t ("Hello wxWidgets World");
Frame->createstatusbar ();
Frame->setstatustext (_t ("Hello World"));
button = new Wxbutton ((Wxframe *) frame,-2, _t ("123"));
Frame->show (TRUE);
Settopwindow (frame);
return true;
}
To perform the compilation:
$ (wx-config--cxx) hello.cpp $ (wx-config--libs--cxxflags)-O Hello
Execute the program:
./hello
Can see WXGTK window, feel also can, I do not map, more critical is, with Wx-config,makefile writing is also a lot easier, we can makefile by executing the shell to get the information including file and library file, As we can write at the beginning of makefile.
cxx:=$ (Shell Wx-config--cxx)
libs:=$ (Shell Wx-config--libs)
cxxflags:=$ (Shell Wx-config--cxxflags)
In the back you can use cxx as a compiler, using Libs as a connection library, with Cxxflags as the inclusion of the library use, but do not forget to use the $ (CXX), $ (Libs) and $ (cxxflags), so makefile writing is a lot easier. The specific makefile here will not write, or believe you understand.
[Zhuan] Linux under WxWidgets installation, compilation