I am trying to compile a test GTK program following instructions in the "C_GUI_Programming" document found at
https://www.raspberrypi.org/magpi/is...i-programming/ Page 77. I have installed libgtk2.0 and libgtk2.0-dev.
The code:
Code:
#include <gtk/gtk.h>
int main ( int argc, char *argv[] )
{
gtk_init ( &argc, &argv );
GtkWidget *win = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
gtk_widget_show ( win );
gtk_main ( );
return 0;
}
Code:
$ gcc `pkg-config --cflags --libs gtk+-2.0` gtktest.c -o gtktest
/tmp/ccQtPQqB.o: In function `main':
gtktest.c:(.text+0x12): undefined reference to `gtk_init'
gtktest.c:(.text+0x18): undefined reference to `gtk_window_new'
gtktest.c:(.text+0x20): undefined reference to `gtk_widget_show'
gtktest.c:(.text+0x24): undefined reference to `gtk_main'
collect2: error: ld returned 1 exit status
The output from pkg-confg follows. I have replaced spaces with newlines to make readable.
Code:
$ pkg-config --cflags --libs gtk+-2.0
-pthread
-I/usr/include/gtk-2.0
-I/usr/lib/arm-linux-gnueabihf/gtk-2.0/include
-I/usr/include/gio-unix-2.0/
-I/usr/include/cairo
-I/usr/include/pango-1.0
-I/usr/include/atk-1.0
-I/usr/include/cairo
-I/usr/include/pixman-1
-I/usr/include/gdk-pixbuf-2.0
-I/usr/include/libpng16
-I/usr/include/pango-1.0
-I/usr/include/harfbuzz
-I/usr/include/pango-1.0
-I/usr/include/glib-2.0
-I/usr/lib/arm-linux-gnueabihf/glib-2.0/include
-I/usr/include/freetype2
-I/usr/include/libpng16
-I/usr/include/freetype2
-I/usr/include/libpng16
-lgtk-x11-2.0
-lgdk-x11-2.0
-lpangocairo-1.0
-latk-1.0
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lpangoft2-1.0
-lpango-1.0
-lgobject-2.0
-lglib-2.0
-lfontconfig
-lfreetype
What's missing?