wxWidgets-Tutorial 004 – wxWidgets auf Ubuntu-Linux installieren und ein erstes Beispielprojekt

In diesem Video zeige ich, wie man wxWidgets unter Linux, in unserem Szenario Ubuntu, installieren kann.

wxWidgets auf Ubuntu-Linux installieren und ein erstes Beispielprojekt
wxWidgets auf Ubuntu-Linux installieren und ein erstes Beispielprojekt

Installiert werden kann wxWidgets folgendermaßen:

1
sudo apt install libwxgtk3.0-gtk3-dev

Hier der Quellcode von unserer Test-Anwendung:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <wx/wx.h>
 
class MyApp : public wxApp {
 
    public:
        bool OnInit();
 
};
 
class MyFrame : public wxFrame {
 
    public:
        MyFrame();
 
};
 
IMPLEMENT_APP(MyApp)
 
bool MyApp::OnInit() {
    MyFrame *myFrame = new MyFrame;
    myFrame->Show();
    SetTopWindow(myFrame);
 
    return true;
}
 
MyFrame::MyFrame() : wxFrame(nullptr, wxID_ANY, "Meine wx-App") {
    wxStaticText *staticText = new wxStaticText(this, wxID_ANY, "Hello World");
}

Und so wird es kompiliert:

1
c++ mywxapp.cpp -o mywxapp `wx-config --libs --cppflags` -std=c++11

Danach sieht es in etwa so aus:

Installation von wxWidgets unter Ubuntu
Installation von wxWidgets unter Ubuntu

Hier geht es zum Video.

Schreibe einen Kommentar