# #include <gtk/gtk.h> not found...



## sk8harddiefast (Nov 9, 2011)

I try to create for the first time in my life something using gtk. the problem is that compiler cannot see the header. But:

```
[ember@Universe /usr/home/ember]$ cd /usr/local/include/gtk-2.0/gtk/      
[ember@Universe /usr/local/include/gtk-2.0/gtk]$ ls -al gtk.*
-r--r--r--  1 root  wheel  7584 Nov  8 08:27 gtk.h
```
Is there! Any idea how to make it work?


----------



## thegolum35 (Nov 9, 2011)

Hi,

Try replacing <gtk/gtk.h> by </usr/local/include/gtk-2.0/gtk/gtk.h>

Gollum


----------



## ikreos (Nov 9, 2011)

If I remember right you have to use pkg-config(1) when you develop with gtk+.


----------



## Carpetsmoker (Nov 9, 2011)

Please include the command(s) you issued and the *full* error message you get. Right now you haven't provided enough information to tell where your problem is.

My first though, however, if that you didn't include *-I/usr/local/include/gtk-2.0/* in your cc(1) command. An example command might be: `% cc -I/usr/local/include -I/usr/local/include/gtk-2.0 -L/usr/local/include -lgtk-x11-2 -o file file.c`


----------



## sk8harddiefast (Nov 9, 2011)

Ok. I didn't compile it with Geany. I change to the full header path and 
	
	



```
gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0`
```
. Solved


----------



## ikreos (Nov 9, 2011)

Don't put the full header path in your source files. Use what the gtk+ documentation says. That's why they use pkg-config(1) to tell gcc where to find the header files.


----------



## sk8harddiefast (Nov 9, 2011)

Work but's true. If was not for educations purpose, the full header path on source, sounds bad idea


----------



## expl (Nov 10, 2011)

My generic Makefile for gtk20 apps:


```
BINDIR   = /usr/local/bin

PROGï»¿   = gtk-app

SRCSï»¿   = main.c        # config, main()
SRCSï»¿  += dialogs.c     # dialogs

CSTDï»¿  = c99              # C standard
CFLAGSï»¿  += -ggdb    # Include debugging symbols
CFLAGSï»¿  += -I/usr/local/include
CFLAGS  += `pkg-config --cflags gtk+-2.0`

LDADDï»¿   = -L/usr/local/lib
LDADDï»¿  += -lm -lz             # extra libs go here
LDADDï»¿  += `pkg-config --libs gtk+-2.0`
LDADDï»¿  += -lgthread-2.0  # extra gnome libs go here

#we don't have any man files
NOMANï»¿   = 1
NO_MANï»¿   = 1

WARNSï»¿  ?= 0 # warning level

.include <bsd.prog.mk>  # using generic make/install/clean routines
```


----------

