Getting GTK4 to work with Xcode

Hi everyone, sorry if this post comes off odd, I'm on heavy meds

but I intend to do foss gtk development in c on my Mac using Xcode, I've used brew to download the gtk libraries and I've individually added each path to each library for autocorrect and intelligence in Xcode

But when I build a GTK app in Xcode I get a bunch of 'Unresolved Symbol' messages, here's an example:

Undefined symbol: _g_application_get_type

I also get about 460 warnings from various libraries stating:

/opt/homebrew/Cellar/cairo/1.18.2/include/cairo/cairo.h:2773:5 '@callback' command should be used in a comment attached to a pointer to function declaration

I understand that when you need to compile GTK, you need to pass a command to the compiler (in this case pkg-config --libs --cflags gtk4), where in Xcode's project manager do I add that code? I think I'm supposed to run that command and add the output somewhere line by line to a combobox in Xcode, but where? "other linker flags"?

Has anyone had any luck compiling GTK apps directly from Xcode?

Answered by unidef in 805668022

I figured it out, you need to add ALL libraries and c flags to compiler options, and you should be able to compile and run GTK apps directly from Xcode.

Accepted Answer

I figured it out, you need to add ALL libraries and c flags to compiler options, and you should be able to compile and run GTK apps directly from Xcode.

Getting GTK4 to work with Xcode
 
 
Q