Thread: Problem with a GLIB

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    2

    Question Problem with a GLIB

    Hi everybody,

    I'm having a problem with my compiler and it goes like this:

    I've included the glib.h library like this:

    #include </usr/include/glib-2.0/glib.h>

    Now, the compiler seems to find glib.h, and seems to identify the type GList which is defined in GLIB. So far so good. BUT, when I try to use a g_list function (e.g. g_list_append), I get an error message that it cannot find the definition of the function.

    Now, the way glib.h works is that there are numerous inclusions in it referring to different g*.h files that reside under a directory called "glib" which, like glib.h, resides in directory "glib-2.0".

    The point is that the compiler doesn't seem to find any of the included files g*.h under directory "glib".

    The error messages that I'm getting are:
    /home/knoppix/workspace/glib.h:30:26: error: glib/galloca.h: No such file or directory
    /home/knoppix/workspace/glib.h:31:25: error: glib/garray.h: No such file or directory
    /home/knoppix/workspace/glib.h:32:30: error: glib/gasyncqueue.h: No such file or directory
    ...
    ...
    /home/knoppix/workspace/glib.h:49:24: error: glib/glist.h: No such file or directory
    /home/knoppix/workspace/glib.h:50:26: error: glib/gmacros.h: No such file or directory
    /home/knoppix/workspace/glib.h:51:24: error: glib/gmain.h: No such file or directory
    ...
    and it goes on and on...



    Does anyone know why it's doing this and how I can solve it?

    Thanks!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > #include </usr/include/glib-2.0/glib.h>
    This should be
    #include <glib.h>

    So it can find the rest of the files, you should add this to the command line something like
    gcc -I/usr/include/glib-2.0 prog.c
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    2
    Thanks dude, now it seems to have found the rest of the files, BUT now I get an infinite number of errors. The compiler reports a syntax error on every second line of the g*.h files...

    I must still be doing something wrong... any idea?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Be more specific than "an error", by posting a few examples of actual error messages.
    The first error message in particular is most important.

    Maybe you forgot to include something else.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM