使用ccl库读取配置文件

下载、编译、安装库.

wget http://files.sbooth.org/ccl-0.1.1.tar.gz
tar -xvf ccl-0.1.1.tar.gz
cd ccl-0.1.1
./configure
make
make install
ldconfig

测试:

在解压后的文件夹,有个demo文件夹,运行以下命令即可进行测试.

[root@localhost ccl-0.1.1]# cd demo/
[root@localhost demo]# ./tester simple.conf 
(Background Color,Black)
(Desktop-Picture,/usr/images/earth.jpg)
(Position,Centered)

注意事项:

如果要使用g++编译

则cpp文件包含ccl头文件时,采用以下的方式,

extern "C"{
#include "ccl/ccl.h"
}

否则,编译的时候会报以下错误

[root@localhost cpptmp]# g++ tester.cpp -o tester -lccl
/tmp/cc8VjFgx.o: In function `main':
tester.cpp:(.text+0x93): undefined reference to `ccl_parse(ccl_t*, char const*)'
tester.cpp:(.text+0xa2): undefined reference to `ccl_iterate(ccl_t*)'
tester.cpp:(.text+0xe4): undefined reference to `ccl_release(ccl_t*)'
collect2: 错误:ld 返回 1

编译和测试:

[root@localhost cpptmp]# g++ tester.cpp -o tester -lccl
[root@localhost cpptmp]# ./tester simple.conf 
(Background Color,Black)
(Desktop-Picture,/usr/images/earth.jpg)
(Position,Centered)



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值