【问题标题】:my IDE doesn't display the window it suppose to display despite not having any errors in my code, how can i fix this尽管我的代码中没有任何错误,但我的 IDE 没有显示它应该显示的窗口,我该如何解决这个问题
【发布时间】:2020-08-04 21:13:42
【问题描述】:

我正在使用 wxwidets 执行我的第一个程序,并且我正在使用 Visual Studio 2019 社区,该程序应该显示一个空窗口,但是当我在我的 IDE 上按下调试时,调试完成且没有错误,但它没有显示窗口,我多次查看代码并没有发现任何错误。它还显示了许多警告第一个代码是 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;
}

【问题讨论】:

  • 您将程序构建为 Windows 还是控制台应用程序?另外,你能构建和运行最小的样本吗?您是自己构建库还是使用预构建的二进制文件?
  • 我将它构建为窗口,我可以运行示例,我构建我自己

标签: visual-studio wxwidgets


【解决方案1】:

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

警告是无关的,显然也有一个bug

【讨论】:

    猜你喜欢
    • 2021-06-19
    • 1970-01-01
    • 1970-01-01
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 2018-08-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多