[SOLVED] "<gtk/gtk.h> not found" when trying to compile C GTK program.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"<gtk/gtk.h> not found" when trying to compile C GTK program.
Hi,
I'm on Linux Mint 20.2 Cinnamon, and I have libgtk-3-0 (already present by default) and libgtk-3-dev (via apt on command line) installed. gtk-3.0 is present in usr/include, with gtk, gdk and unix-print folders present inside.
When trying to compile a C program with an empty main() function and the only #include being <gtk/gtk.h>, this error is thrown: "fatal error: gtk/gtk.h: No such file or directory".
I made some progress by doing "#include <gtk-3.0/gtk/gtk.h>", however this just gave this error instead, in gtk.h: "/usr/include/gtk-3.0/gtk/gtk.h:30:10: fatal error: gdk/gdk.h: No such file or directory"
I'm using geany to edit, but using cc and gcc at command line produced the same errors.
For anyone having the same problem who is new to all of this like me, you can set what the command Geany uses to build the program by going to Build > Set Build Commands, to save you writing it all out on the command line every time. This is what it ended up being for me (for Build, not Compile) gcc "%f" -Wall -o "%e" `pkg-config --cflags --libs gtk+-2.0`
For reference, I did have the header files in the location teckk provided.
Last edited by bcsm; 07-25-2021 at 12:31 PM.
Reason: Added build command
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.