使用eclipse编译jsonCpp

来源:互联网 发布:河豚充气原理知乎 编辑:程序博客网 时间:2024/05/16 09:17

1.自已废了很大劲安装使用vs2010,结果还是无法编译jsoncpp,估计是太新的,很多语法报错

 

2.

 

 

 

 

 

3.测试

 

#include <stdio.h>#include <json/json.h>#include <string>using namespace std;int main(int argc, char **argv) {std::string strValue = " {\"key1\":\"value1\",\"array\":[ {\"key2\":\"value2\"},{\"key2\":\"value3\"},{\"key2\":\"value4\"}]}";Json::Reader reader;Json::Value value;if (reader.parse(strValue, value)) {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;}}while(1);return 1;}


添加动态lib

整个过程中我们使用eclipse帮我们生成动态库,当是你必须知道怎么去编写makefile,这个你才知道如何去使用eclipse

 

0 0
原创粉丝点击