You are not logged in.

#1 2006-12-17 15:57:09

johnny5
Member
From: oohsa
Registered: 2006-11-24
Posts: 6

gtk/gtk.h causes compilation failure [solved]

$ cat >> test.c << "EOF"
># include <gtk/gtk.h>
>int main (int argc, char **argv)
>{
>  return 0;
>}
>EOF
$ gcc test.c

this simple peice of code does not compile due to complaints about missing header files. my gtk.h is in /usr/include/gtk-{1.2,2.0}/, and when I use the -I switch to specify the search path this file is found...but header files referenced within gtk.h are then said to be unavailable. I have to add a long list of -I switches to get around this problem at the moment. Isn't there some sort of env var I can set to get around this? I have gtk-1.2 and gtk-2.0 installed (hence the bash notation above) on my machine, is there a way to prevent apps from confusing the gtk.h of one version with another?

Thank you much

Offline

#2 2006-12-17 16:02:42

harlekin
Member
From: Germany
Registered: 2006-07-13
Posts: 408

Re: gtk/gtk.h causes compilation failure [solved]

The classic command line to compile a GTK+ based program is

gcc -o myprog [c files] `pkg-config gtk+-2.0 --cflags --libs`

GTK FAQ

Maybe you can do something linke pkg-config gtk+-1.0?


Hail to the thief!

Offline

#3 2006-12-17 22:28:15

johnny5
Member
From: oohsa
Registered: 2006-11-24
Posts: 6

Re: gtk/gtk.h causes compilation failure [solved]

Very much thanks! I am relatively new to Linux (hence the newb section) and attempting to re-learn my programming skills in this new environment out of a book - but they don't say "If pkg-config is unavailable then do such and such...". I figured since it wasn't installed by default that there must have been an arch way to do things, however, after your suggestion I ran `pacman -Sy pkgconfig` and it works just fine. I assume it was my error that pkg-config wasn't installed by default, so color me blundered (awesome). - distro and community continues to make me smile, hopefully after a few more of my uglies ill give a bit back.


GTK FAQ ... indeed.

Offline

Board footer

Powered by FluxBB