PDA

View Full Version : Gtk/gtk.h doesn't exist... C question


proboardslol
June 22nd, 2009, 06:04 PM
source:

#include <gtk/gtk.h>

int main()
{
g_print ("Hello World\n");
}


got this

collin@lappylol:~/Desktop$ gcc fun.c -o Funlol.out
fun.c:1:21: error: gtk/gtk.h: No such file or directory
collin@lappylol:~/Desktop$

Can+~
June 22nd, 2009, 06:16 PM
Stick to a tutorial instead of trying to guess:

http://library.gnome.org/devel/gtk-tutorial/stable/

You'll need to link manually to gtk.

proboardslol
June 22nd, 2009, 06:23 PM
thanks, i did use a tutorial, just not a very good one i guess :\

Paul Miller
June 22nd, 2009, 07:06 PM
Linking isn't the issue; it's not even finding the header file. That tells me you probably need to install libgtk1.2-dev or libgtk2.0-dev (pick the appropriate one).

SledgeHammer_999
June 22nd, 2009, 10:13 PM
you don't tell gcc where to find gtk
you should type this:
gcc fun.c `pkg-config --libs --cflags gtk+-2.0` -o Funlol.out
After you isntall libgtk2.0-dev