After drafting my first program using the GTK+ library:
Code:
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return 0;
}
I tried to compile it:
Code:
[Cam@localhost simple]$ gcc simplewindow.cpp -o simplewindow `pkg-config --cflags --libs gtk+-2.0`
/tmp/ccpifIYo.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
After a little searching, I found that this was the result of using the C compiler (gcc) on a C++ project. The solution: Use G++!!!
Code:
[Cam@localhost simple]$ g++ simplewindow.cpp -o simplewindow `pkg-config --cflags --libs gtk+-2.0`
This was a simple enough fix, and a stupid error, but I thought it was confusing enough for a beginning linux programmer to post its solution
I intend to post on the various mountains I encounter while beginning my GTK+ linux programming journey... but meanwhile, I hope this helps you.