Sample Header Ad - 728x90

GTK installation on Mac doesn't seem to be working

0 votes
1 answer
1287 views
I have been trying to get started on GTK for Mac. I followed the [installation steps](https://www.gtk.org/docs/installations/macos/) and ran the [hello-world program](https://www.gtk.org/docs/getting-started/hello-world/) . I keep getting this error with gcc, though. Running
gcc $(pkg-config --cflags gtk4) -o hello-world-gtk hello-world-gtk.c $(pkg-config --libs gtk4)
returns the following errors:
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk4' found
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk4' found
hello-world-gtk.c:1:10: fatal error: 'gtk/gtk.h' file not found
#include 
         ^~~~~~~~~~~
1 error generated.
I found a [similar problem](https://stackoverflow.com/questions/20098862/how-to-install-gtk-on-osx-for-use-with-g-gcc-compiler) here, but the user says they already have gcc/g++ working. I don't. Any ideas? I ran the installation script included in the installation steps and all I get is an error.
Asked by Infection Tag (1 rep)
Sep 3, 2022, 01:23 AM
Last activity: May 29, 2025, 10:05 AM