编译wxWidgets示例时出错 [英] Error compiling wxWidgets example

查看:157
本文介绍了编译wxWidgets示例时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对wxwidgets有一个小问题,请参阅内部资源:

I have a small question for wxwidgets, see inside source:

#include "wx/wx.h"
class MyApp : public wxApp
{
    public:
    virtual bool OnInit();
};

class MyFrame : public wxFrame
{
    public:
    MyFrame(const wxString & title);
    void OnQuit(wxCommandEvent & event);
    void OnAbout(wxCommandEvent & event);
    private :
    DECLARE_EVENT_TABLE()
};

DECLARE_APP(MyApp)
IMPLIMENT_APP(MyApp)

bool MyApp::OnInit()//the proplem in here, after it complied that result is:
                    //error: expected constructor, destructor, 
                    //or type conversion  before "bool"

{
    MyFrame *frame = new MyFrame(wxT("Minimal wxWidget App"));
    frame->Show(true);
    return true;
}

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
    EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
END_EVENT_TABLE()

void MyFrame::OnAbout(wxCommandEvent & event)
{
    wxString msg;
    msg.Printf(wxT("Hello and Welcome to %s"),
                wxVERSION_STRING);

    wxMessageBox(msg, wxT("About Minimal"),
                    wxOK|wxICON_INFORMATION,this);
}

void MyFrame::OnQuit(wxCommandEvent & event)
{
    Close();
}

#include "mondrian.xpm"

MyFrame::MyFrame(const wxString & title)
    :wxFrame(NULL, wxID_ANY, title)
{
    SetIcon(wxIcon(mondrian_xpm));

    wxMenu *fileMenu = new wxMenu;
    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"),
                        wxT("Show about dailog"));
    fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"),
                        wxT("Quit this program"));

    wxMenuBar * MenuBar = new wxMenuBar();
    MenuBar->Append(fileMenu, wxT("&File"));
    MenuBar->Append(helpMenu, wxT("&Help"));

    SetMenuBar(MenuBar);

    CreateStatusBar(2);
    SetStatusText(wxT("Welcome to wxWidgets!"));
}

推荐答案

Louis Cooper写道:
Louis Cooper wrote:

IMPLIMENT_APP(MyApp)

IMPLIMENT_APP(MyApp)



应该是IMPLEMENT_APP(MyApp)



Should be IMPLEMENT_APP(MyApp)


:-D Ar !!对,就是那样!非常感谢:thumbsup:
:-D Ar!! Yes, That''s it! thank you very much:thumbsup:


这篇关于编译wxWidgets示例时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆