I am trying to use gui with gkt-2.0 in Linux mint 32bit. When I try to compile gui.c I encountered following error message:
#include<gtk-2.0/gtk/gtk.h>
void main(){
}
In file included from gui.c:1:0:
/usr/include/gtk-2.0/gtk/gtk.h:32:10: fatal error: gdk/gdk.h: No such file or directory
#include <gdk/gdk.h>
^~~~~~~~~~~
When the appropriate packages are installed, you can add the needed include search directories with option -I
, and the libraries of course -l
, e.g.
gcc -I/usr/include/gtk-2.0 gui.c -o gui -lgtk-2.0
The source should be changed to
#include <gtk/gtk.h>
To avoid hard-coding any paths and names, you could use pkg-config (Compiling GTK Applications on UNIX)
gcc $(pkg-config --cflags gtk+-3.0) gui.c -o gui $(pkg-config --libs gtk+-3.0)
Better yet, use make
or some other build tool.