1

I went to the site: https://developer.gnome.org/gtk3/stable/gtk-getting-started.html and typed in the example-0.c (I renamed it as First_Window.c). However, I get the message after this command to compile:

gcc `pkg-config --cflags gtk+3.0` -o First_Window First_Window.c `pkg-config --libs gtk+-3.0`

Package gtk+3.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk+3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+3.0' found First_Window.c:8:21: fatal error: gtk/gtk.h: No such file or directory #include

After editing the include file to path: #include </usr/include/gtk-3.0/gtk/gtk.h>, I then receive a new error.

Package gtk+3.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk+3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+3.0' found In file included from First_Window.c:9:0: /usr/include/gtk-3.0/gtk/gtk.h:30:21: fatal error: gdk/gdk.h: No such file or directory #include

Found some articles on exporting the path. I can't find them now, but none of them worked anyway.

Will someone either tell me how to set or export the path or solve this?

1 Answer 1

2

It looks like you are missing a '-' sign in your first pkg-config statement. Try adding the '-' sign so that the entire command is:

gcc `pkg-config --cflags gtk+-3.0` -o First_Window First_Window.c `pkg-config --libs gtk+-3.0`

You should also amend the include path back to how it was before:

#include <gtk/gtk.h>

And then try compiling again.

Gnome offers more help on using/testing pkg-config here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.