下载、编译、安装库.
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)