Glib实例学习(0)开始

1Glib概述

Glib是一个底层库,她提供了一系列的的数据类型以及关于这些数据的操作,这些数据类型大概包括:

  • Memory chunks
  • Doubly-linked lists
  • Singly-linked lists
  • Hash tables
  • Strings (which can grow dynamically)
  • String chunks (groups of strings)
  • Arrays (which can grow in size as elements are added)
  • Balanced binary trees
  • N-ary trees
  • Quarks (a two-way association of a string and a unique integer identifier)
  • Keyed data lists (lists of data elements accessible by a string or integer id)
  • Relations and tuples (tables of data which can be indexed on any number of fields)
  • Caches

2:从“Hello world”开始 

 
 
  1. #include <stdio.h>  
  2. #include <glib.h>  
  3.  
  4. int 
  5. main(int agrc, char **argv)  
  6. {  
  7.     g_printf("Hello world!\n");  
  8.  
  9.     return 0;  
 
 
  1. $ gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 -o hello hello.c  
  2.  
  3. $ ./hello 
鉴于手工指定库相关信息比较麻烦而且容易出错,大部分的发行版Linux都提供了pkgconfig工具:
 
 
  1. $ gcc `pkg-config --cflags --libs glib-2.0` -o hello hello.c  
  2.  
  3. $ ./hello 

<参考>

http://developer.gimp.org/api/2.0/glib/index.html

http://www.ibm.com/developerworks/linux/tutorials/l-glib/index.html 

下节预告:Glib实例学习(2)单链表

转载自:http://blog.chinaunix.net/space.php?uid=25696269&do=blog&id=466217


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值