Results 1 to 3 of 3

Thread: Beginning GTK - Undefined References

  1. #1
    Join Date
    Nov 2009
    Beans
    38

    Beginning GTK - Undefined References

    I'm trying to learn how to use the C++ GTK library. I've tried with GTKMM, but it's not working. I've also used gtk.h. I'm developing in C++ eclipse. Now, with an EXTREMELY basic script (11 lines) it will include gtk.h, but it says undefined reference to gtk_init. Please. Help. HELP. HHHEEELLLPPP.

  2. #2
    Join Date
    Jul 2006
    Location
    Germany
    Beans
    1,805

    Re: Beginning GTK - Undefined References

    Make sure that you have the packages build-essential and libgtk2.0-dev installed.

    You also need to link GTK+ and its companion libraries when compiling. In a terminal, you should be able to compile your program with the command
    Code:
    g++ -o yourprog yourprog.cpp `pkg-config gtk+-2.0 --cflags --libs`
    There is probably an easy way to link the necessary libraries in Eclipse as well, but I have never used that application.
    Last edited by mali2297; February 27th, 2011 at 11:31 AM.
    ...

  3. #3
    Join Date
    Nov 2009
    Beans
    38

    Re: Beginning GTK - Undefined References

    *Headdesk* How come none of the other g++ commands for compiling this didn't work? >_> Anyway, thank you.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •