I have successfully built a simple hello world app using newest GTK+. I used msys2 to install all dependencies including GTK+, compile and link the program. When ran it is supposed to open a new window, but nothing happens. When run under gdb it shows new threads getting created. Same issue is present even if I use eclipse CDT to do the build. With eclipse I am able set a breakpoint just before calling g_application_run
which is hit. All vars such as app variable looks valid. Any pointers to what could be causing this issue?
please click here to see the stack trace: https://i.stack.imgur.com/Orhn3.jpg
I also took one of the latest source packages and built it with msys2. Same issue present with demo samples. For example gtk3-demo.exe.
code:
#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;
}
The activate function never gets called. I do not have the source of gtk so cannot step in to g_application_run.
compile command:
g++ -I"C:\msys64\opt\gtk\include\gtk-3.0" -I"C:\msys64\mingw64\include\glib-2.0" -O0 -g3 -Wall -c -essage-length=0 -mms-bitfields -pthread -mms-bitfields -I/mingw64/include/gtk-3.0 -I/mingw64/include/cairo -I/mingw64/include -I/mingw64/include/pango-1.0 -I/mingw64/include/atk-1.0 -I/mingw64/include/cairo -I/mingw64/include/pixman-1 -I/mingw64/include -I/mingw64/include/freetype2 -I/mingw64/include/libpng16 -I/mingw64/include/harfbuzz -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -I/mingw64/include -I/mingw64/include/freetype2 -I/mingw64/include -I/mingw64/include/harfbuzz -I/mingw64/include -I/mingw64/include/libpng16 -I/mingw64/include/gdk-pixbuf-2.0 -I/mingw64/include/libpng16 -I/mingw64/include -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -I/mingw64/include -MMD -MP -MF"main.d" -MT"main.o" -o "main.o" "../main.cpp"
link command:
g++ ./main.o -mwindows -L/opt/gtk/lib -L/mingw64/lib -L/mingw64/lib -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lz -lepoxy -lpangocairo-1.0 -lpangoft2-1.0 -lpangowin32-1.0 -lgdi32 -lusp10 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lz -lpixman-1 -lfontconfig -lexpat -lfreetype -liconv -lexpat -lfreetype -lbz2 -lharfbuzz -lm -lgraphite2 -lpng16 -lz -lgdk_pixbuf-2.0 -lm -lpng16 -lz -lgio-2.0 -lz -lgmodule-2.0 -pthread -lgobject-2.0 -lffi -lglib-2.0 -lintl -pthread -lws2_32 -lole32 -lwinmm -lshlwapi -lpcre -lintl -lpcre -o "FabEngineGui.exe"
I used eclipse CDT configured to use msys64 bit environment to build this. I also tried using msys2 shell directly with same results.
echo $MSYSTEM
MINGW64