!! PENDING POST !!
This is not an actual post but just a short note for anyone (including myself) learning the GNOME’s GTK+ widget toolkit from the GNOME’s Development Center, especially if you’re running on macOS as I am.
After you successfully compile the first few tutorials and land on the “Building Application” page, the first example here shows you a simple script:
#include <gtk/gtk.h>#include "exampleapp.h" int main (int argc, char *argv[]){ return g_application_run (G_APPLICATION (example_app_new ()), argc, argv);}
This is actually main.c from examples/application1 directory in GTK+’s git repository. The repository itself has a makefile however it wouldn’t work on macOS due to some of the arguments used in the file –> This is the purpose of this post, to be able to write a proper makefile for macOS.
However, if you’d like to compile it successfully on your macOS, delete/move the Makefile.example file from your local GTK’s git directory and clone the makefile from my repository here. It’s not the best makefile, a lot can be made better, but in the midst of juggling various other things, I’ve made something that works.
If you don’t want to use this makefile but want to compile it yourself, you could do so with this command:
gcc main.c exampleapp.c exampleappwin.c -o main `pkg-config gtk+-3.0 --cflags pkg-config gtk+-3.0 --libs`
If not for this solution, I would’ve given up on GTK+ and moved to Qt & C++.
Comments