|
|
|
ASIC/FPGA Design and Verification Out Source Services
A very simple example to Manage C data using the
GLib library.
-
My first step was to run the example from
Glib tutorial.
-
To install Glib on my debian machine, I need to fire this command, as super-user:
apt-get install libglib2.0-dev
-
To find the
required libraries
to compile and link the simple Glib example:
pkg-config --cflags --libs glib-2.0
Then compiled and linked:
gcc -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -lglib-2.0 -o try try.c
-
The code is listed below. Note that I slightly modified the code.
- #include <stdlib.h>
- #include <stdio.h>
- #include <glib.h>
- int main(int argc, char** argv) {
- GList* list = NULL;
- list = g_list_append(list, "Hello world!");
- printf("The first item is '%s'\n", g_list_first(list)->data);
- return 0;
- }
-
You may be interested also in :
GHDL c interfaces and extensions.
My first cpp program to work on text.
|
| |