我正在使用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()
。
这个警告是不相关的,显然也有一个错误。