Re: Newbie Question: How i can use glib-2.0 in my c-programm ?



On Tue, 26 Jun 2007 23:27:25 +0200 Kai Szymanski wrote:

Hi!

As i search the web for a util-library that i can use in my
c-programms, i found glib-2.0. So i decide to install it on my system
(debian 4.0 - libglib-2.0 and libglib-2.0-dev). When i try to use it,
i did'nt work. The Source (a simple test):

-- Snip
#include <stdio.h>

#include <glib-2.0/glib.h>

Well, for starters, this should just be "#include <glib.h>".

void main(int argc, char *argv) {
   gstring *gs = NULL;
}

That's "GString", not "gstring".

db03:/home/ks/src/test/Release# gcc -o test test.c -I
/usr/include/glib-2.0/ -I /usr/lib/glib-2.0/include/

Don't hard-code the include/library paths.  Use pkg-config, something
like this:

gcc -o test test.c `pkg-config glib-2.0 --cflags --libs`

        -brian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]