Ubuntu10.04下安装json-c_12

  1. 新立得安装autoconf或sudo apt-get install autoconf
  2. 下载json-c
  3. tar -xvf json-c-0.12.1.tar.gz
  4. cd json-c-0.12.1
  5. sed -i s/-Werror// Makefile.in tests/Makefile.in &&
    ./configure –prefix=/usr –disable-static && make -j1
  6. make check
  7. sudo make install
  8. 检查目标安装目录是否存在libjson:
    [root@TEST json-c-0.12.1]# ll /usr/lib/libjson-c.*
    -rwxr-xr-x 1 root root 914 Apr 23 09:01 /usr/lib/libjson-c.la
    lrwxrwxrwx 1 root root 18 Apr 23 09:01 /usr/lib/libjson-c.so -> libjson-c.so.2.0.2
    lrwxrwxrwx 1 root root 18 Apr 23 09:01 /usr/lib/libjson-c.so.2 -> libjson-c.so.2.0.2
    -rwxr-xr-x 1 root root 99537 Apr 23 09:01 /usr/lib/libjson-c.so.2.0.2
  9. 验证json-c库是否可用:
    找到json-c源码目录中的tests目录,其中给出了大量测试程序,我们选择一个test_parse.c文件,进行测试:
    编译测试程序:
    gcc test_parse.c -I/usr/include/json-c -L/usr/lib/ -ljson-c
    注意编译的参数:
    -I 表示头文件的查找路径
    -L 表示库文件的链接路径
    -l 表示要链接的库名称(不需要写lib前缀,只需要写出库名即可)
  10. 运行a.out:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值