I want to learn to use GTK3 but I am not able to compile the first example.
I installed MSYS2
and ran:
pacman -S mingw-w64-x86_64-gtk3
followed by:
pacman -S mingw-w64-x86_64-glade
and:
pacman -S mingw-w64-x86_64-devhelp
I installed it at c:\MSYS64
which is the default location but when I try and run
gcc `pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0`
to compile the Simple Window tutorial
#include <gtk/gtk.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_widget_show_all (window);
}
int main (int argc, char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
I get an error:
C:\Users\Simon\Desktop\webbrowser>gcc `pkg-config --cflags gtk+-3.0` -o example-1 example-1.c `pkg-config --libs gtk+-3.0`
gcc: error: `pkg-config: No such file or directory
gcc: error: gtk+-3.0`: No such file or directory
gcc: error: example-1.c: No such file or directory
gcc: error: `pkg-config: No such file or directory
gcc: error: gtk+-3.0`: No such file or directory
gcc: error: unrecognized command line option '--cflags'
gcc: error: unrecognized command line option '--libs'
gcc: fatal error: no input files
compilation terminated.
This is from command prompt so I thought of trying to use MSYS2 shell but I got an error saying -bash: gcc: command not found
. I also tried moving the script to C:\msys64\home\
but that returns the same error.
Somewhere I have skipped something or am doing something wrong but I really cannot understand what. I have been trying for the past month (on and off) and would really appreciate any help.
I use MinGW on Windows if that helps.