赞
踩
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,Perl, Ruby 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.
下载对应包
进入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!");
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。