wxWidgets的HelloWorld

1.安装MSYS2

2.在MSYS2中安装wxWidgets

3.测试代码如下:

#include <wx/wx.h>

class Simple : public wxFrame
{
public:
	Simple(const wxString& title);

};

Simple::Simple(const wxString& title)
	: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
	Centre();
}

class MyApp : public wxApp
{
public:
	virtual bool OnInit();
};

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
	Simple *simple = new Simple(wxT("Simple"));
	simple->Show(true);

	return true;
}

4. 动态编译

g++ Hello.cpp `wx-config --cxxflags --libs` -o hello

5. 静态编译

g++ -static Hello.cpp `wx-config --cxxflags --libs --static` -o hello

posted @ 2016-03-30 14:41  小艾利  阅读(540)  评论(0编辑  收藏  举报