http://blog.sina.com.cn/s/blog_70508e7f01015lkz.html
1.下载scons 在这里http://www.scons.org/
解压
# export SCONS_LIB_DIR=$MYSCONS/engine
2.json 下载:http://sourceforge.net/projects/jsoncpp/
- #tar -zxf scons-2.1.0.tar.gz
- #cd scons-2.1.0
- #python setup.py install
- #tar -zxf jsoncpp-src-0.5.0.tar.gz
- #cd jsoncpp-src-0.5.0
- #scons platform=linux-gcc
- #mv libs/linux-gcc-4.1.2/libjson_linux-gcc-4.1.2_libmt.so /lib
- #mv include/json/ /usr/include/
- #ldconfig
- #./bin/linux-gcc-4.1.2/test_lib_json
- Testing ValueTest/size: OK
- Testing ValueTest/isObject: OK
- Testing ValueTest/isArray: OK
- Testing ValueTest/isBool: OK
- Testing ValueTest/isInt: OK
- Testing ValueTest/isUInt: OK
- Testing ValueTest/isDouble: OK
- Testing ValueTest/isString: OK
- Testing ValueTest/isNull: OK
- All 9 tests passed
3.json入门指南:
http://www.ibm.com/developerworks/cn/web/wa-lo-json/
4.使用示例
新建main.cpp
#include "json/json.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
}
编译命令为:g++ jsoncpptest.cpp -I/root/software/jsoncpp-src-0.5.0/include -L/root/software/json
编译成功
./a.out时错误,说是找不到.so文件,解决办法有:
1.将jsoncpp编译后的.so文件拷贝到当前项目目录中
2.编辑/etc/ld.so.conf文件,将.so文件所在的路径加进去,同时加入/usr/local/lib
然后用命令/sbin/ldconfig -v对.so的配置进行更新
5.JsonCpp
http://www.cnblogs.com/ggjucheng/archive/2012/01/03/2311107.html