Jump to content
  • Advertisement
Sign in to follow this  
_mycoplasma_

undefined reference error when compiling gtk apps for linux

This topic is 4384 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

sorry if this is in the wrong forum; i wasn't sure if i should put it in For beginners or everything unix I just started reading the GTK+ tutorial at http://www.gtk.org/tutorial/ and i am stuck at the very beginning because i cannot compile the first example, a program that creates a window with gtk and does nothing. Everytime i try to compile it, gcc gives me this output:
/usr/local/lib/libpango-1.0.so: undefined reference to `g_type_register_static_simple' collect2: ld returned 1 exit status [/QUOTE] I'm not sure, but I think the problem might be related to either a missing header file or a linker error because using synaptic package manager to download newer versions of Glib, GTK, and pango have not fixed this problem. Here is the source code:
[source lang = 'c']
#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;
}


and here is what i type into the command line to invoke gcc:
gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0` [/QUOTE] my distro is ubuntu, and im compiling with gcc. can someone please help me?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!