尽管我的代码中没有任何错误,但我的IDE不会显示它应该显示的窗口,我该如何解决此问题

问题描述 投票:0回答:1

我正在使用wxwidets编写我的第一个程序,并且正在使用Visual Studio 2019社区,该程序应该显示一个空窗口,但是当我在IDE上按debug时,调试完成,没有错误,但是没有显示该窗口,我多次检查代码,找不到任何错误。它还显示许多警告,第一个代码为c28251,并说“ WinMain注释不一致:此实例没有注释”

FrameOne.h:-

#include<wx/wx.h>
class FrameOne :public wxFrame
{
public:
    FrameOne();

};

FrameOne.cpp

include"FrameOne.h"
FrameOne::FrameOne():wxFrame(nullptr,wxID_ANY,"Simple",wxPoint(200,200),wxSize(300,300))
{}

main.h

#include<wx/wx.h>
#include"FrameOne.h"
class strtmain :public wxApp
{
public:
    strtmain();
    ~strtmain();
    virtual bool InOnit();

};

main.cpp

#include "main.h"
wxIMPLEMENT_APP(strtmain);
strtmain::strtmain()
{
}
strtmain::~strtmain()
{
}

bool strtmain::InOnit()
{
    FrameOne* simple = new FrameOne();
    simple->Show();
    return true;
}
visual-studio wxwidgets
1个回答
0
投票

您应该覆盖wxApp::OnInit(),而不是InOnit()

警告是不相关的,并且显然也有bug

© www.soinside.com 2019 - 2024. All rights reserved.