User Tools

Site Tools


programming:gtk4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
programming:gtk4 [2022/03/21 05:06]
nanodano
programming:gtk4 [2022/03/21 05:19]
nanodano
Line 150: Line 150:
 cd libsigc++-3.2.0 cd libsigc++-3.2.0
 cmake . cmake .
 +./autogen.sh --prefix=/usr/local --enable-static
 make make
 sudo make install sudo make install
Line 158: Line 159:
 tar xzf glibmm-2.70.0.tar.gz tar xzf glibmm-2.70.0.tar.gz
 cd glibmm-2.70.0 cd glibmm-2.70.0
-./autogen.sh --prefix=/usr/local+./autogen.sh --prefix=/usr/local --enable-static
 make make
 sudo make install sudo make install
Line 167: Line 168:
 tar xBf cairomm-1.16.1.tar.xz tar xBf cairomm-1.16.1.tar.xz
 cd cairomm-1.16.1 cd cairomm-1.16.1
-./autogen.sh --prefix=/usr/local+./autogen.sh --prefix=/usr/local --enable-static
 make make
 sudo make install sudo make install
Line 176: Line 177:
 tar xzf pangomm-2.50.0.tar.gz tar xzf pangomm-2.50.0.tar.gz
 cd pangomm-2.50.0 cd pangomm-2.50.0
-./autogen.sh --prefix=/usr/local+./autogen.sh --prefix=/usr/local --enable-static
 make make
 sudo make install sudo make install
Line 185: Line 186:
 tar xBf gtkmm-4.6.0.tar.xz tar xBf gtkmm-4.6.0.tar.xz
 cd gtkmm-4.6.0 cd gtkmm-4.6.0
-./autogen.sh --prefix=/usr/local+./autogen.sh --prefix=/usr/local --enable-static
 make make
 sudo make install sudo make install
Line 193: Line 194:
  
  
-When compiling, use ''-std=c++20'' flag. When running, you may need to set LD_LIBRARY_PATH if you installed to a special prefix.+When compiling, use ''-std=c++20'' flag. When running, you may need to set LD_LIBRARY_PATH if you installed to a special prefix. Maybe able to add ''-static'' if you built all libs with ''--enable-static' configuration and a ''.a'' file is in the lib dir.
  
 <code bash> <code bash>
Line 201: Line 202:
 # Set path for shared library when running # Set path for shared library when running
 LD_LIBRARY_PATH=/usr/local/lib ./a.out LD_LIBRARY_PATH=/usr/local/lib ./a.out
 +</code>
 +
 +Here is a gtkmm hello world:
 +
 +<code cpp main.cpp>
 +// gtkmm4 example
 +
 +// Compile with:
 +// g++ main.cpp `pkg-config gtkmm-4.0 --cflags --libs` -std=c++20
 +
 +// Run with
 +// LD_LIBRARY_PATH=/usr/local/lib ./a.out
 +#include <gtkmm.h>
 +
 +class MyWindow : public Gtk::Window
 +{
 +public:
 +  MyWindow();
 +};
 +
 +MyWindow::MyWindow()
 +{
 +  set_title("Basic application");
 +  set_default_size(200, 200);
 +}
 +
 +int main(int argc, char* argv[])
 +{
 +  auto app = Gtk::Application::create("org.gtkmm.examples.base");
 +
 +  return app->make_window_and_run<MyWindow>(argc, argv);
 +}
 </code> </code>
programming/gtk4.txt ยท Last modified: 2022/03/21 05:19 by nanodano