Kai Szymanski escribió:
> 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>
>
> void main(int argc, char *argv) {
>     gstring *gs = NULL;
> }
>
> -- Snip
>
> db03:/home/ks/src/test/Release# gcc -o test test.c -I
> /usr/include/glib-2.0/ -I /usr/lib/glib-2.0/include/
> test.c: In function `main':
> test.c:6: Fehler: »gstring« nicht deklariert (erste Benutzung in dieser
> Funktion)
> test.c:6: Fehler: (Jeder nicht deklarierte Bezeichner wird nur einmal
> aufgeführt
> test.c:6: Fehler: für jede Funktion in der er auftritt.)
> test.c:6: Fehler: »gs« nicht deklariert (erste Benutzung in dieser Funktion)
> test.c:5: Warnung: Rückgabetyp von »main« ist nicht »int«
>
> -- Snip
>
> Sorry, german text. It say's:
>     test.c:6: Error: »gstring« not declared
>
> Hmmm :)
>
> Thanks for your help.
>
> CU,
>    Kai.
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   

First, note that the type is GString not gstring. Remember C is case 
sensitive.

Example:

#include <glib.h>

int main ()
{
    GString *gstr = g_string_new ("Hola");
    printf  ("GString: %s\n", gstr->str);
    g_string_free (gstr, TRUE);
    return 0;
}


Compile like this:

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



Matias.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to