gcc can't find gtk.h

This is a discussion on gcc can't find gtk.h within the Linux Programming forums, part of the Platform Specific Boards category; I am trying to compile the gtk hello world program but gcc can't seem to find gtk.h. The header files ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    167

    gcc can't find gtk.h

    I am trying to compile the gtk hello world program but gcc can't seem to find gtk.h. The header files are in the usr directory. How do i fix this?
    silk.odyssey

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    are they in the includes directory? ie: /usr/include/

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    Yes they're in /usr/include/gtk-2.0. Anyway instead of trying to compile it from the commandline, I created a gtk project with anjuta and removed the extra files it generated by default and pasted my original code and it worked fine. I'm also downloading a newer version of gtk.
    silk.odyssey

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Bah makefile all the way glad you got it working

  5. #5
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    Glad to see yoyu are getting into GTK. I am okay; I havent' done it in a while. But if you need help feel free to ask here.

  6. #6
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    Well I'm curious about GUI programming on linux and the C interface to gtk doesn't look too scary like other frameworks like KDE
    silk.odyssey

  7. #7
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    It isn't hard. I thought so. Easier than windows programming if it is as hard as it freaking looks. So ugly IMO

  8. #8
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    lol windows programming can be tedious but i would prefer that than KDE. I guess its because I don't know C++ well
    silk.odyssey

  9. #9
    C and Assembly Programmer
    Join Date
    Jul 2004
    Posts
    1
    Well, you probably forgot to link the the gtk+ library. If you would want to compile it from the command line remember to use pkg-config (for gtk 2.0 and higher).

    gcc -Wall -o hellogtk hellogtk.c `pkg-config gtk+-2.0 --cflags --libs`

    Try that and it will probably compile from the command line.

  10. #10
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Welcome to the boards Dan. In the future you may wish to avoid responding to threads that are dead. This thread is over two weeks old and the orginally poster has already responded that they have it working.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linux find utilty
    By vaibhavs17 in forum Tech Board
    Replies: 5
    Last Post: 05-12-2009, 04:40 AM
  2. Gcc can't find obvious copy constructor
    By SevenThunders in forum C++ Programming
    Replies: 13
    Last Post: 03-19-2009, 02:41 PM
  3. gcc or g++ Question
    By TK in forum Linux Programming
    Replies: 3
    Last Post: 07-17-2002, 10:36 AM
  4. gcc 3.1
    By itld in forum C++ Programming
    Replies: 1
    Last Post: 05-18-2002, 04:00 AM
  5. GCC compile error coz of file pointer
    By Shadow in forum C Programming
    Replies: 5
    Last Post: 04-20-2002, 12:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21