wxWidgets C++ : simple application crashes on arch linux, but not on my windows machine

I’ve been trying to create a wxWidgets C++ application under my EndeavourOS (should be arch linux at it’s core).
My Desktop Environment is KDE Plasma (Wayland). But I the same problems occur on GNOME, and XFCE also.
I was already successful compiling a wxWidgets C++ application under Windows.

But on Linux, my compiled simple Program crashes.
Here is the C++ Code:

#include <wx/wx.h>
//#include "class.hpp"

class MyFrame: public wxFrame{
    public:
    MyFrame() : wxFrame(nullptr, wxID_ANY, "WxWidgets Linux Program") {
        wxPanel* mainPanel = new wxPanel(this);
        wxButton* cancel = new wxButton(mainPanel, wxID_ANY, "Cancel");
        SetClientSize(500, 50); // it seems thgt this makes the program crash
        Center(); // and this also
    }
};

class App : public wxApp {
public:
    bool OnInit() {
        MyFrame* w = new MyFrame();
        w->Show();

        return true;
    }
};

wxIMPLEMENT_APP(App);

I Compiled my program with this command:
g++ main.cpp -o prog wx-config --cppflags --libs

When I run the program, the console gives the following output:

./prog: /usr/lib/libwx_gtk3u_core-3.2.so.0: no version information available (required by ./prog)
./prog: /usr/lib/libwx_baseu-3.2.so.0: no version information available (required by ./prog)
./prog: Symbol `_ZTV8wxButton' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV9wxControl' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV12wxButtonBase' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV11wxAnyButton' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV11wxPanelBase' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV7wxPanel' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV17wxMDIClientWindow' has different size in shared object, consider re-linking
./prog: Symbol `_ZTV7wxFrame' has different size in shared object, consider re-linking
Speicherzugriffsfehler (Speicherabzug geschrieben)
// english translation: Memory access error (memory dump written)

Program terminated with signal SIGSEGV, Segmentation fault.

This is the stacktrace I get with gdb:

User
(gdb) bt
#0  0x00006e6f74747562 in ??? ()
#1  0x00007ffff7950f43 in wxWindow::PreCreation (this=this@entry=0x55555566ef80, parent=parent@entry=0x555555724500, pos=..., size=...) at /usr/src/debug/wxwidgets/wxWidgets-3.2.4/src/gtk/window.cpp:2953
#2  0x00007ffff79533f3 in wxWindow::Create (this=0x55555566ef80, parent=0x555555724500, id=-1, pos=..., size=..., style=2621440, name=...) at /usr/src/debug/wxwidgets/wxWidgets-3.2.4/src/gtk/window.cpp:2841
#3  0x00007ffff77abf16 in wxPanelBase::Create (this=0x55555566ef80, parent=<optimized out>, id=<optimized out>, pos=<optimized out>, size=<optimized out>, style=<optimized out>, name=...) at /usr/src/debug/wxwidgets/wxWidgets-3.2.4/src/common/panelcmn.cpp:98
#4  0x0000555555564da0 in wxPanel::wxPanel(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&) ()
#5  0x0000555555565b84 in MyFrame::MyFrame() ()
#6  0x0000555555565da0 in App::OnInit() ()
#7  0x0000555555563e79 in wxAppConsoleBase::CallOnInit() ()
#8  0x00007ffff70f1452 in wxEntry (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/wxwidgets/wxWidgets-3.2.4/src/common/init.cpp:481
#9  0x000055555556354b in main ()

The strange thing is: the following code runs just fine (except that scaling the window sometimes hangs the program)

#include <wx/wx.h>

class App : public wxApp {
public:
    bool OnInit() {
        
        wxFrame* window = new wxFrame(NULL, wxID_ANY, "GUI Test", wxDefaultPosition, wxSize(600, 400));
        wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
        wxStaticText* text = new wxStaticText(window, wxID_ANY, "Well Done!nEverything seems to be working",
            wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
        text->SetFont(wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
        sizer->Add(text);
        window->SetClientSize(300, 300);
        window->SetSizer(sizer);
        window->Show();
        return true;
    }
};

I searched for hours, but I could find anything specific.
Thanks for your help and advice in advance.
P.S.: I am not a linux expert – just installed EndeavorOS last week

New contributor

tbone is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật