Windows10 vs2015 編譯wxWidgets

wxWidgets is a C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base. It has popular language bindings for Python,PerlRuby and many other languages, and unlike other cross-platform toolkits, wxWidgets gives applications a truly native look and feel because it uses the platform's native API rather than emulating the GUI. It's also extensive, free, open-source and mature.

 

官網:https://www.wxwidgets.org/

 

下載對應包

進入wxWidgets目錄

本人是  E:\wxWidgets-3.1.2\build\msw

 

vs2015打開 wx_vc14.sln

 

本人用的 /MT  所以 項目 c++ 生成代碼  運行庫 選擇 多線程/MT

 

然後編譯出來後得到 23個lib

 

然後加載到項目  

 

鏈接庫 裏面 輸入 

 

include 就是wxWidgets裏面的include  然後把 編譯出來的 E:\wxWidgets-3.1.2\lib\vc_x64_lib\mswu\wx 下面的 setup.h copy到

E:\wxWidgets-3.1.2\include\wx下面

到此就可以了。

可以試試例子  當然就是 hello world

wxbase31u.lib
wxbase31u_net.lib
wxbase31u_xml.lib
wxexpat.lib
wxjpeg.lib
wxmsw31u_adv.lib
wxmsw31u_aui.lib
wxmsw31u_core.lib
wxmsw31u_gl.lib
wxmsw31u_html.lib
wxmsw31u_media.lib
wxmsw31u_propgrid.lib
wxmsw31u_qa.lib
wxmsw31u_ribbon.lib
wxmsw31u_richtext.lib
wxmsw31u_stc.lib
wxmsw31u_webview.lib
wxmsw31u_xrc.lib
wxpng.lib
wxregexu.lib
wxscintilla.lib
wxtiff.lib
wxzlib.lib
winmm.lib
comctl32.lib
rpcrt4.lib
wsock32.lib
wininet.lib
#include <stdio.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include <wx/wxprec.h>

class MyApp : public wxApp
{
public:
	virtual bool OnInit();
};
class MyFrame : public wxFrame
{
public:
	MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
private:
	void OnHello(wxCommandEvent& event);
	void OnExit(wxCommandEvent& event);
	void OnAbout(wxCommandEvent& event);
	wxDECLARE_EVENT_TABLE();
};
enum
{
	ID_Hello = 1
};
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Hello, MyFrame::OnHello)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
wxEND_EVENT_TABLE()
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
	MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
	frame->Show(true);
	return true;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
	: wxFrame(NULL, wxID_ANY, title, pos, size)
{
	wxMenu *menuFile = new wxMenu;
	menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
		"Help string shown in status bar for this menu item");
	menuFile->AppendSeparator();
	menuFile->Append(wxID_EXIT);
	wxMenu *menuHelp = new wxMenu;
	menuHelp->Append(wxID_ABOUT);
	wxMenuBar *menuBar = new wxMenuBar;
	menuBar->Append(menuFile, "&File");
	menuBar->Append(menuHelp, "&Help");
	SetMenuBar(menuBar);
	CreateStatusBar();
	SetStatusText("Welcome to wxWidgets!");
}
void MyFrame::OnExit(wxCommandEvent& event)
{
	Close(true);
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
	wxMessageBox("This is a wxWidgets' Hello world sample",
		"About Hello World", wxOK | wxICON_INFORMATION);
}
void MyFrame::OnHello(wxCommandEvent& event)
{
	wxLogMessage("Hello world from wxWidgets!");
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章