> nmake /f makefile.vc
> nmake /f makefile.vc BUILD=release
> nmake /f makefile.vc BUILD=release SHARED=1
在此文件的 Makefile parameters 部分。
wxbase30ud_net.lib
wxmsw30ud_html.lib
wxbase30ud_xml.lib
wxmsw30ud_adv.lib
wxmsw30ud_aui.lib
wxmsw30ud_gl.lib
wxmsw30ud_media.lib
wxmsw30ud_propgrid.lib
wxmsw30ud_qa.lib
wxmsw30ud_ribbon.lib
wxmsw30ud_richtext.lib
wxmsw30ud_stc.lib
wxmsw30ud_xrc.lib
wxscintillad.lib
wxmsw30ud_core.lib
wxbase30ud.lib
wxtiffd.lib
wxjpegd.lib
wxpngd.lib
wxzlibd.lib
wxexpatd.lib
winmm.lib
comctl32.lib // 以下4个千万不要忘记添加,否则会报 链接错误 错,
rpcrt4.lib
wsock32.lib
odbc32.lib
release 选项:
wxbase30u.lib
wxbase30u_net.lib
wxbase30u_xml.lib
wxexpat.lib
wxjpeg.lib
wxmsw30u_adv.lib
wxmsw30u_aui.lib
wxmsw30u_core.lib
wxmsw30u_gl.lib
wxmsw30u_html.lib
wxmsw30u_media.lib
wxmsw30u_propgrid.lib
wxmsw30u_qa.lib
wxmsw30u_ribbon.lib
wxmsw30u_richtext.lib
wxmsw30u_stc.lib
wxmsw30u_xrc.lib
wxpng.lib
wxregexu.lib
wxscintilla.lib
wxtiff.lib
wxzlib.lib
comctl32.lib // 此两项不要忘记,否则会报 链接错误 错,
rpcrt4.lib
5、预处理器定义
Hello world 代码:
#include "wx\wxprec.h"
#include "wx\wx.h"
#include
#include
using namespace std;
#ifndef WX_PRECOMP
#include "include\wx\wx.h"
#endif
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);
// main function this macro is the main function
// create an application instance and starts the program
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",
"Hello string show 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!");
}
更多编译方法及对各种编译器的支持,请参考解压文件夹下的如下文件:
%%%%%\docs\readme.txt
%%%%%\docs\msw\install.txt //windows的安装方法
%%%%%\docs\osx\install.txt // 苹果操作系统的安装方法
%%%%%\docs\x11\install.txt //LINUX操作系统的安装方法