windows下 jsoncpp的编译和使用
来源:互联网 发布:网络前端设计师 编辑:程序博客网 时间:2024/06/05 10:33
- 解压下载好的文件:jsoncpp-src-0.5.0.tar.gz
- 利用VS2010打开jsoncpp-src-0.5.0\makefiles\vs71目录下的jsoncpp.sln,会出现三个Project:jsontest, lib_json, test_lib_json
- 在lib_json上右击-->Properties-->Configuration Properties-->C/C++-->Code Generation,设置RunTime Library 为MTD
- 在jsoncpp-src-0.5.0\build\vs71\debug\lib_json目录下会生成一个json_vc71_libmtd.lib,将这个lib拷贝至TestJSON工程目录下。
- 将jsoncpp-src-0.5.0\include\json目录下的所有.h文件拷贝至TestJSON工程目录下,并在工程Header Files引入.
- 在TestJSON工程名上 右击-->Properties-->Configuration Properties-->C/C++-->Code Generation, 将Runtime Library设置为MTD。
- TestJson-->Properties-->Configuration Properties-->Linker-->Input, 在Additional Dependencies里填写json_vc71_libmtd.lib,然后确定,编译就行了。
#include <iostream>#include <string>#include "json.h"int main(void){std::string strValue="{\"key1\":\"value1\",\"array\":[{\"key2\":\"value2\"},{\"key2\":\"value3\"},{\"key2\":\"value4\"}]}"; Json::Reader reader;//json解析Json::Value value;//表示一个json格式的对象if(reader.parse(strValue,value))//解析出json放到json中区{std::string out=value["key1"].asString();std::cout<<out<<std::endl;const Json::Value arrayObj=value["array"];//迭代器for (int i=0; i < arrayObj.size();i++) {out=arrayObj[i]["key2"].asString();std::cout<<out;if(i!=arrayObj.size()-1)std::cout<<std::endl;;}}getchar();return 0;}
0 0
- windows下 jsoncpp的编译和使用
- JSONCpp在windows下的VC6编译和调用
- jsoncpp在linux和windows下的编译及使用详解
- Jsoncpp的编译和使用
- Jsoncpp的编译和使用
- linux下jsoncpp的编译和测试使用
- linux下jsoncpp的编译和测试使用
- Windows下使用jsoncpp
- vs2012 编译jsoncpp和使用jsoncpp lib出现的问题
- vs2012 编译jsoncpp和使用jsoncpp lib出现的问题
- linux下jsoncpp的编译安装使用
- linux下jsoncpp的编译安装使用
- linux下jsoncpp的编译安装使用
- VS下 jsoncpp的编译使用教程
- JSONCPP在VS2013的编译和使用
- Linux 下编译JsonCpp与使用
- jsoncpp Linux下编译及使用
- linux下jsoncpp编译与使用
- 2014多校第四场1006 HDU 4902 Nice boat 线段树 区间更新问题
- mac下面eclipse的快捷键
- android liseview 的一些知识
- 树莓派系统基础配置
- 【学习笔记】C++高级程序设计:STL标准模板库
- windows下 jsoncpp的编译和使用
- 你是普通程序员、文艺程序员还是2B程序员?
- openvswitch有port和bridge
- poj 1080 Human Gene Functions DP
- AP_INVOICES_ALL应付发票表详解
- awk成长篇的几个例子
- js飘窗效果
- Localizable.strings:0: error: read failed: The data couldn’t be read because it isn’t in the correct
- EJB技术的数据库应用