0

I am attempting to compile code using the <gtk/gtk.h> header file using gcc. Whenever I do so I get the following error:

gtk.c:3:10: fatal error: gtk/gtk.h: No such file or directory

3 | #include <gtk/gtk.h> ^~~~~~~~~~~

I have looked in /usr/include/ and found gtk-1.2 gtk-2.0 and gtk-3.0 all of which have the header files within them necessary to compile the program I'm unsure why GCC can't find those files and how to reroute gcc to find the necessary header files.

1
  • 1
    Did you set the include path? Commented Apr 11, 2021 at 13:55

1 Answer 1

1

GCC doesn't know which version you want to use. GTK recommends using pkg-config to compile programs. For example, for GTK 3 use:

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

You could also specify the correct include and library paths yourself.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.