I'm a beginning C++ programmer and want to use Code::Blocks IDE on Debian based Linux to write some GUI programs.
Therefore I would like to use gtkmm 3.0 with this code:
#include <gtkmm/gtkmm.h>
int main(int argc, char *argv[])
{
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.examples.base");
Gtk::Window window;
window.set_default_size(200, 200);
return app->run(window);
}
The compiler gives me this error:
fatal error: gtkmm/gtkmm.h: No such file or directory
I followed these steps to install gtkmm:
Installed Code::Blocks and was able to compile non-GUI programs.
Then installed gtkmm-3.0 with synaptic.
In Code::Blocks settings > compiler > compiler settings > other compiler options I set:
pkg-config --cflags gtk+-3.0
In codeblock settings > compiler> linker settings > other linker settings I set:
pkg-config --libs gtk+-3.0
When compiling I got the next error in Build log:
Build file: "no target" in "no project" (compiler: unknown) [ 50.0%] g++ -std=c++14 -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -c /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.cpp -o /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.o [100.0%] g++ -o /home/meltdown/Documents/C++/GTKmm2019C/t1/t1 /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.o -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /home/meltdown/Documents/C++/GTKmm2019C/t1/t1.cpp:2:10: fatal error: gtkmm/gtkmm.h: No such file or directory 2 | #include <gtkmm/gtkmm.h> | ^~~~~~~~~~~~~~~ compilation terminated. Process terminated with status 1 (0 minute(s), 0 second(s)) 1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I use a single .cpp file, not a Gtk+ project.
I've tried this and this but no luck. Does anyone know how to set up Code::Blocks and its compiler properly for gtkmm?
Project
(menu)-> Build Options...
(submenu)-> Compiler settings
(tab, should be the default)-> Other compiler options
(tab). – JaMiT