You are not logged in.

#1 2010-03-18 06:18:05

karmal
Member
Registered: 2009-11-15
Posts: 7

[Solved] how to program with glib2 library

i'm a bit new to C programming, after some consideration, i've decided to use GLib library.

can anybody tell me how to include glib (2) in a C program.

tried: #include <glib-2.0/glib.h>

but it failed.

thanks in advance.

Last edited by karmal (2010-03-22 02:24:03)

Offline

#2 2010-03-18 06:59:47

e_tank
Member
Registered: 2006-12-21
Posts: 80

Re: [Solved] how to program with glib2 library

use:

#include <glib.h>

in your source file and then use pkg-config to generate the necessary cflag and lib options to pass to gcc.  for example, if you had a project with a single source file called glib_test.c you could compile it using the following command:

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

Offline

#3 2010-03-18 07:14:52

karmal
Member
Registered: 2009-11-15
Posts: 7

Re: [Solved] how to program with glib2 library

EDIT: it works.

thank you very much.

Last edited by karmal (2010-03-18 07:33:40)

Offline

Board footer

Powered by FluxBB