VS2013 Build wxwidgets development environment

Source: Internet
Author: User
Tags wxwidgets

First, installation

Go to the official website to download the latest wxwidgets 3.0.0.

Https://sourceforge.net/projects/wxwindows/files/3.0.0/wxMSW-3.0.0-Setup.exe/download

After downloading the default installation, you can modify the installation path.

Second, compile

Open the installation directory wxWidgets-3.0.0 find WX.DSW under BUILD\MSW.

Open wx.dsw with VS2013 and wait for the project to complete from VC6 to VS2013.

The solution structure is as shown.

Right-click on the solution, click on batch build, tick all debug and release (can be selected as needed), click Build to compile.

At this point, the Wxwidgets-3.0.0\lib\vc_lib directory, as shown below, has generated the required library files, where u represents the release version and UD represents the debug version.

Third, the configuration

New WIN32 Console application, Application type tick Windows application or console application.

New source file test.cc, paste the following code.

WxWidgets "Hello World" program//for compilers, includes "wx/wx.h". #include <wx/wxprec. h> #ifndef wx_precomp#include <wx/wx.h> #endifclass myapp:public wxapp{public:virtual bool OnInit ();}; Class Myframe:public Wxframe{public:myframe (const wxstring& title, const wxpoint& POS, const wxsize& size);p Rivate: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::O Ninit () {//myframe *frame = new MyFrame ("Hello World", Wxpoint (+), Wxsize (450, 340)); MyFrame *frame = new MyFrame ("Hello World", Wxdefaultposition, Wxdefaultsize); 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_hell O, "&hello...\tctrl-h", "Help string shown on 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 was a wxWidgets ' Hello World Sample", "About Hello World ", Wxok | wxicon_information);} void Myframe::onhello (wxcommandevent& event) {wxlogmessage ("Hello World from Wxwidgets!");}

  

1. Include directory

Right-click the project, open the Project Properties page, configure an item to select all configurations

Configuration Properties->c/c++-> General, additional include directories are added:

C:\wxWidgets-3.0. 0 \includec:\wxwidgets-3.0. 0\LIB\VC_LIB\MSWU

2. Library Directory

Add in the Additional libraries directory, general----the linker, configuration properties

C:\wxWidgets-3.0. 0\lib\vc_lib  

, MFC's use

Configuration Property->MFC use: Using standard Windows libraries

4. Dependencies

Additional dependencies, such as the linker, configuration properties, and so on, are added according to the following rules:

A, the configuration of a change to release

Wxbase30u.libwxbase30u_net.libwxbase30u_xml.libwxexpat.libwxjpeg.libwxmsw30u_adv.libwxmsw30u_aui.libwxmsw30u_ Core.libwxmsw30u_gl.libwxmsw30u_html.libwxmsw30u_media.libwxmsw30u_propgrid.libwxmsw30u_qa.libwxmsw30u_ Ribbon.libwxmsw30u_richtext.libwxmsw30u_stc.libwxmsw30u_ Xrc.libwxpng.libwxregexu.libwxscintilla.libwxtiff.libwxzlib.libcomctl32.librpcrt4.lib

B, configure a change to debug

Wxbase30ud_net.libwxmsw30ud_html.libwxbase30ud_xml.libwxmsw30ud_adv.libwxmsw30ud_aui.libwxmsw30ud_ Gl.libwxmsw30ud_media.libwxmsw30ud_propgrid.libwxmsw30ud_qa.libwxmsw30ud_ribbon.libwxmsw30ud_ Richtext.libwxmsw30ud_stc.libwxmsw30ud_xrc.libwxscintillad.libwxmsw30ud_ Core.libwxbase30ud.libwxtiffd.libwxjpegd.libwxpngd.libwxzlibd.libwxexpatd.libwinmm.libcomctl32.librpcrt4.libwsock32.libod Bc32.lib

5. Pre-processor definition

Configure a change to debug

Configuration Properties->c/c++-> Preprocessor---preprocessor definitions are added:

__wxmsw____wxdebug__

6, can be compiled after saving

VS2013 Build wxwidgets development environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.