имеется arhclinux, wxwidgets, c++ (gcc)
код:
mainwindow.cpp
#include "mainwindow.hpp"
#include <stdexcept>
MainWindow::MainWindow() :
wxFrame( nullptr, wxID_ANY, "WEGA-HPG-cpp-wx" ), mMainPanel( new wxPanel() ),
mTabs( new wxNotebook() ) {
mMainPanel->SetParent( this );
mTabs->SetParent( mMainPanel );
auto panel = new wxPanel();
mTabs->AddPage( panel, "TAB1" );
mTabs->Show();
mMainPanel->Show();
}
mainwindow.hpp
#include <wx/wx.h>
#include <wx/panel.h>
#include <wx/notebook.h>
#include <vector>
class MainWindow : public wxFrame {
public:
MainWindow();
~MainWindow() = default;
private:
wxPanel * mMainPanel;
wxNotebook * mTabs;
std::vector< wxPanel * > mPanels;
};
main.cpp
#include "ui/mainwindow.hpp"
#include <iostream>
#include <wx/chartype.h>
#include <wx/init.h>
#include <wx/wx.h>
#include <cstdlib>
class HpgApp final : public wxApp {
bool OnInit() override {
MainWindow * mainwindow = new MainWindow;
mainwindow->CreateStatusBar();
mainwindow->SetStatusText( "HPG status" );
mainwindow->Show();
//std::cout << "TEST" << std::endl;
//SetTopWindow( mainwindow );
return true;
}
//MainWindow mainwindow;
};
//DECLARE_APP( HpgApp )
//IMPLEMENT_APP( HpgApp )
int main( int argc, char ** argv ) {
[[maybe_unused]] HpgApp * app = new HpgApp;
wxEntry( argc, argv );
return EXIT_SUCCESS;
}
при запуске получается
./src/gtk/notebook.cpp(409): assert "m_widget != __null" failed in InsertPage(): invalid notebook
zsh: trace trap (core dumped) ./src/wega-hpg-cpp-wx
решение: тут и тут