Use of Jsoncpp

Source: Internet
Author: User

First download the latest version of the Jsoncpp library to the GitHub website: https://github.com/open-source-parsers/jsoncpp

Click Download Zip in the lower right corner to download



Unzip the following as follows:



Open Makefiles\vs71\jsoncpp.sln with VS

First set the Lib_json as the startup project, and the compile connection may have the following error:


Do not care about it, and then set Jsontest and Test_lib_json for the startup items, compile the connection, my jsontest no error, but Test_lib_json error, do not care about it.

You just have to see another folder build in the Unzip directory, find build\vs71\debug\lib_json\json_vc71_libmtd.lib static link library, this is what we really need.


OK, let's start by testing whether the generated static libraries are working properly.

Create a blank project for a Win32 console application

Create a new main.cpp source file:

Copy into the following code:

#include <iostream>  #include "json//json.h"  #include <iostream> #pragma comment (lib, "json_vc71_ Libmtd.lib ")  int main ()  {      json::value val;      Json::styledwriter Style_write;        val["name"] = Json::value ("Xiaoli");        Std::cout << Style_write.write (val) << Std::endl;  GetChar ();    return 0;  }  


Then copy the generated json_vc71_libmtd.lib static link library and the Josn folder (all the library header files) to the current project directory:

Another thing to note here is to change the code generation properties of the test project to the same properties as Lib_json: The following is the code generation properties for the Lib_json project:

Right-Lib_json Project: "Properties", "Configuration Properties", "C/C + + project", "Code generation"


Here are the code generation properties for our test project:


Change the red mark above the different parts of the same line, compile and run the following results show that we can normally use the Jsoncpp library.



http://blog.csdn.net/lp310018931


Use of Jsoncpp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.