The problem is that bough g++ and gcc can't find "gtk/gtk.h": "gtk.cpp:1: fatal error: gtk/gtk.h: No such file or directory
compilation terminated."
I have already installed libgtk2.0-dev and it doesn't help. How can I solve that issue? Thank you!
You're missing some include paths.
Add the following to the compiling call: `pkg-config gtk+-2.0 --cflags`
And the following to the linking call: `pkg-config gtk+-2.0 --libs`
Note that there is gtkmm, which is probably a better choice if you're using C++.
Fixed the syntax error, and tried to compile: g++ gtk.cpp -Os -s `pkg-config gtk+-2.0 --cflags` `pkg-config gtk+-2.0 --libs`
And this is what I get:
1 2 3 4 5 6 7 8
gtk.cpp: In function ‘int main(int, char**)’:
gtk.cpp:5: error: ‘GtkWidget’ was not declared in this scope
gtk.cpp:5: error: ‘window’ was not declared in this scope
gtk.cpp:7: error: ‘gtk_init’ was not declared in this scope
gtk.cpp:9: error: ‘GTK_WINDOW_TOPLEVEL’ was not declared in this scope
gtk.cpp:9: error: ‘gtk_window_new’ was not declared in this scope
gtk.cpp:10: error: ‘gtk_widget_show’ was not declared in this scope
gtk.cpp:12: error: ‘gtk_main’ was not declared in this scope
Strange, this compiles fine for me on Ubuntu 10.10.
I assume you're missing another package. You can try installing libgtkmm-2.4-dev. Perhaps it will cause the missing dependency to be installed, whatever it might be.