xmake sample code run failed (Issue #23631)

23 views
Skip to first unread message

xpxz

unread,
Jun 11, 2023, 9:16:17 PM6/11/23
to wx-...@googlegroups.com, Subscribed

xmake-examples/wxWidgets-scaffold#1

When using xmake to build a minimal wxwidget application, the compilation is successful, but after running, an error will occur, prompting wxwidget debug assert

the code is here

#include <wx/wx.h>

namespace Examples {
  class Frame : public wxFrame {
    enum wxOwnedID {
      ID_Hello = 2
    };

  public:
    Frame(): wxFrame(nullptr, wxID_ANY, "Hello World") {
      auto menuFile = new wxMenu();
      menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item");
      menuFile->AppendSeparator();
      menuFile->Append(wxID_EXIT);

      auto menuHelp = new wxMenu();
      menuHelp->Append(wxID_ABOUT);
      auto menuBar = new wxMenuBar();

      menuBar->Append(menuFile, "&File");
      menuBar->Append(menuHelp, "&Help");
      SetMenuBar(menuBar);

      CreateStatusBar();
      SetStatusText("Welcome to wxWidgets!");

      menuBar->Bind(wxEVT_MENU, [&](wxCommandEvent& event) {
        if (event.GetId() == ID_Hello) wxLogMessage("Hello world from wxWidgets!");
        else if (event.GetId() == wxID_ABOUT) wxMessageBox("This is a wxWidgets Hello World example", "About Hello World", wxOK|wxICON_INFORMATION);
        else if (event.GetId() == wxID_EXIT) Close(true);
        else event.Skip();
      });
    }
  };

  class Application : public wxApp {
    bool OnInit() override {
      (new Frame())->Show();
      return true;
    }
  };
}

wxIMPLEMENT_APP(Examples::Application);

Is there something wrong with the code or something wrong with the build process?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23631@github.com>

PB

unread,
Jun 12, 2023, 4:27:03 AM6/12/23
to wx-...@googlegroups.com, Subscribed

Please do not post issues with your code or build process as if it were actual wxWidgets issues. Use another communication channel (e.g., wxForum or wx-users discussion group) for these. Moreover, when posting an actual issue, please post also the relevant build information and assert trace (always as text, not pictures) and also wxWidgets build, version and platform used, see the Issue template.

Anyway, I did not see anything really wrong with your code. But as always:

  1. Use the most recent version of wxWidgets (currently 3.2.2.1 or the GIT master) built with one of the official ways (provided makefiles, cmake, configure...) to make sure you are not running into a bug that may have already been fixed or incorrect build.
  2. Test with the Hello World example from the docs, which is very similar to your code (main frame with a menu and status bar) to see if the issue also manifests there.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23631/1586833630@github.com>

xpxz

unread,
Jun 12, 2023, 4:31:26 AM6/12/23
to wx-...@googlegroups.com, Subscribed

Closed #23631 as completed.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/23631/issue_event/9499312197@github.com>

Reply all
Reply to author
Forward
0 new messages