我正在使用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;
}
您应该覆盖wxApp::OnInit()
,而不是InOnit()
。
警告是不相关的,并且显然也有bug。