当前位置:   article > 正文

Windows10 vs2015 编译wxWidgets_win编译wxwidgets

win编译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

  1. wxbase31u.lib
  2. wxbase31u_net.lib
  3. wxbase31u_xml.lib
  4. wxexpat.lib
  5. wxjpeg.lib
  6. wxmsw31u_adv.lib
  7. wxmsw31u_aui.lib
  8. wxmsw31u_core.lib
  9. wxmsw31u_gl.lib
  10. wxmsw31u_html.lib
  11. wxmsw31u_media.lib
  12. wxmsw31u_propgrid.lib
  13. wxmsw31u_qa.lib
  14. wxmsw31u_ribbon.lib
  15. wxmsw31u_richtext.lib
  16. wxmsw31u_stc.lib
  17. wxmsw31u_webview.lib
  18. wxmsw31u_xrc.lib
  19. wxpng.lib
  20. wxregexu.lib
  21. wxscintilla.lib
  22. wxtiff.lib
  23. wxzlib.lib
  24. winmm.lib
  25. comctl32.lib
  26. rpcrt4.lib
  27. wsock32.lib
  28. wininet.lib
  1. #include <stdio.h>
  2. #ifndef WX_PRECOMP
  3. #include <wx/wx.h>
  4. #endif
  5. #include <wx/wxprec.h>
  6. class MyApp : public wxApp
  7. {
  8. public:
  9. virtual bool OnInit();
  10. };
  11. class MyFrame : public wxFrame
  12. {
  13. public:
  14. MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
  15. private:
  16. void OnHello(wxCommandEvent& event);
  17. void OnExit(wxCommandEvent& event);
  18. void OnAbout(wxCommandEvent& event);
  19. wxDECLARE_EVENT_TABLE();
  20. };
  21. enum
  22. {
  23. ID_Hello = 1
  24. };
  25. wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
  26. EVT_MENU(ID_Hello, MyFrame::OnHello)
  27. EVT_MENU(wxID_EXIT, MyFrame::OnExit)
  28. EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
  29. wxEND_EVENT_TABLE()
  30. wxIMPLEMENT_APP(MyApp);
  31. bool MyApp::OnInit()
  32. {
  33. MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
  34. frame->Show(true);
  35. return true;
  36. }
  37. MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
  38. : wxFrame(NULL, wxID_ANY, title, pos, size)
  39. {
  40. wxMenu *menuFile = new wxMenu;
  41. menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
  42. "Help string shown in status bar for this menu item");
  43. menuFile->AppendSeparator();
  44. menuFile->Append(wxID_EXIT);
  45. wxMenu *menuHelp = new wxMenu;
  46. menuHelp->Append(wxID_ABOUT);
  47. wxMenuBar *menuBar = new wxMenuBar;
  48. menuBar->Append(menuFile, "&File");
  49. menuBar->Append(menuHelp, "&Help");
  50. SetMenuBar(menuBar);
  51. CreateStatusBar();
  52. SetStatusText("Welcome to wxWidgets!");
  53. }
  54. void MyFrame::OnExit(wxCommandEvent& event)
  55. {
  56. Close(true);
  57. }
  58. void MyFrame::OnAbout(wxCommandEvent& event)
  59. {
  60. wxMessageBox("This is a wxWidgets' Hello world sample",
  61. "About Hello World", wxOK | wxICON_INFORMATION);
  62. }
  63. void MyFrame::OnHello(wxCommandEvent& event)
  64. {
  65. wxLogMessage("Hello world from wxWidgets!");
  66. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/40378
推荐阅读
相关标签
  

闽ICP备14008679号