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