0
votes

I installed the GTK3 packages inside of Cygwin and included these directories in the project Include path:

  • C:\Cygwin\usr\include\gtk-3.0
  • C:\Cygwin\lib\glib-2.0\include
  • C:\Cygwin\usr\include\glib-2.0
  • C:\Cygwin\usr\include\pango-1.0
  • C:\Cygwin\usr\include\cairo
  • C:\Cygwin\usr\include\gdk-pixbuf-2.0
  • C:\Cygwin\usr\include\atk-1.0

But when I try to compile this:

#include <gtk/gtk.h>

int main( int argc, char *argv[] ) {
    GtkWidget *window;

    gtk_init ( &argc, &argv );

    window = gtk_window_new( GTK_WINDOW_TOPLEVEL );

    gtk_window_set_title( GTK_WINDOW ( window ), "Hello World" );

    gtk_widget_show( window );

    gtk_main();
}

The build fails with many undefined symbols, undefined references, and relocation truncated to fit: R_X86_64_PC32 against undefined symbol

2
Show us how you compile and link it.JustSomeGuy

2 Answers

0
votes

I read on a different answer I need to add the lib directories to the linker options and that seemed to be my problem

0
votes

Also don't manually include GTK+ include directories or linker flags in your projects. See if you can get your IDE to grab them from pkg-config instead.