Hi,
I am trying to learn C programming making use of GTK 3. I am trying to work through the book "C and GUI Programming" 2nd edition, by Simon Long, pdf freely available from the MagPi magazine website, https://magpi.raspberrypi.com/books and published under a Creative Commons license.
However, I have hit a snag with trying to get gcc to recognise GTK. When I try to compile the first small program using
the system responds with
So far, I have learned that :-
a) I need to set up some kind of .pc file to be used with the PKG_CONFIG_PATH environment variable;
b) there is a gtk-3.0 folder in /usr/share;
c) there is a pkgconfig foler in /usr/share.
What do I place inside this .pc file ?
Am I correct in thinking that I place the .pc file within /usr/share/pkgconfig folder ?
I found a video on YouTube, "Understanding pkg-config command in Linux|Include and Link OpenCV header and library" but this did not show how to make changes to the PKG_CONFIG_PATH environment variable.
As this is the first time that I have had to do this, could someone please point me in the direction of a good video/tutorial that will help me get this "stitching together" set up properly, including where to find this PKG_CONFIG_PATH environment variable ?
Thanks,
Stuart
I am trying to learn C programming making use of GTK 3. I am trying to work through the book "C and GUI Programming" 2nd edition, by Simon Long, pdf freely available from the MagPi magazine website, https://magpi.raspberrypi.com/books and published under a Creative Commons license.
However, I have hit a snag with trying to get gcc to recognise GTK. When I try to compile the first small program using
Code:
gcc gtktest.c `pkg-config --cflags --libs gtk+3.0` -o gtktest
Code:
$ gcc gtktest.c `pkg-config --cflags --libs gtk+3.0` -o gtktestPackage 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 variablePackage 'gtk+3.0', required by 'virtual:world', not foundgtktest.c:1:10: fatal error: gtk/gtk.h: No such file or directory 1 | #include <gtk/gtk.h> | ^~~~~~~~~~~compilation terminated.
So far, I have learned that :-
a) I need to set up some kind of .pc file to be used with the PKG_CONFIG_PATH environment variable;
b) there is a gtk-3.0 folder in /usr/share;
c) there is a pkgconfig foler in /usr/share.
What do I place inside this .pc file ?
Am I correct in thinking that I place the .pc file within /usr/share/pkgconfig folder ?
I found a video on YouTube, "Understanding pkg-config command in Linux|Include and Link OpenCV header and library" but this did not show how to make changes to the PKG_CONFIG_PATH environment variable.
As this is the first time that I have had to do this, could someone please point me in the direction of a good video/tutorial that will help me get this "stitching together" set up properly, including where to find this PKG_CONFIG_PATH environment variable ?
Thanks,
Stuart
Statistics: Posted by Stuarte — 2024-05-18 12:59 — Replies 1 — Views 51