Methods of compiling JSON libraries and importing third-party libraries in VS2010

Source: Internet
Author: User

Methods of compiling JSON libraries and importing third-party libraries in VS2010

First, to the corresponding official website to download json.cpp file

Jsoncpp Download:https://sourceforge.net/projects/jsoncpp/    version v0.5.0 latest version in: https://github.com/ open-source-parsers/jsoncpp  Second, compile the link into the library file 1) Unzip the downloaded JSON package, get the jsoncpp-src-0.5.0 file, open the Jsoncpp-src-0.5.0\makefiles\ VS71\JSONCPP.SLN2) Convert the project to VS2010 format and turn the mode to debug mode 3) In Solution Explorer, right-click  lib_json  Select for Project only  ->   Generate Lib_json4 only) again right-click  lib_json  Select only for Project  ->  link lib_json5 only) Select release mode 6) repeat Operation 3) and 4) Step 7) the generated. lib folder is in jsoncpp-src-0.5.0/build/vs71 .   Create a static link library SDK (software Development Kit) 1) Create a folder E:\study\toolsForVS2010\jsonPP (can be modified to the path where you place the SDK Package) 2) Create the Include and Lib folders in JSONPP. 3)   Create folder  json&nbsp in include, copy all. h files from jsoncpp-src-0.5.0/include/json . 4) Create folders in Lib Debug and release , put the jsoncpp-src-0.5.0/build/vs71/ debug/ lib_json . lib file (for example Json_ Vc71_libmtd.lib) Copy to the Debug folder (you can change the file name to Json.lib), in the same vein, Jsoncpp-src-0.5.0/build/vs71/ release/ lib_json  . lib files (such as Json_vc71_libmtd.lib) are copied to the release folder  

Open the project you want to add JSON to, or create a new WIN32 console program (add main.cpp, join source code, sample code can be found in Jsoncpp.sln json_test)

1) Select Item--Properties

2) Select the "Additional Include Directories" to the general right of the configuration properties, C + +, add Inclusion folder: E:\study\toolsForVS2010\jsonPP\include

3) Select the "Run Library" on the right side of the code generation, C + +, configuration properties, select MTd

4) Select the "Additional Library directory" to add the Lib folder to the general right of the linker, the configuration properties, and so on. E:\study\toolsForVS2010\jsonPP\lib\debug

5) Select "Additional Dependencies" to the right of the input configuration properties, linker, add lib file: Json_vc71_libmtd.lib (if the file name Json.lib is modified in two-4, change this to Json.lib)

6) Click Apply to complete the JSON configuration.

Iv. whether the test was added successfully

Can be tested using the Jsoncpp-src-0.5.0\src\test_lib_json test file in the downloaded JSON package

The compilation passed and the library import was successful.

Note: If the project needs to be published (that is, the project chooses release),

1) Select the "Runtime" option on the right side of the code generation-C + +, configuration properties, MT

2) Select the "Additional Library directory" to add the Lib folder to the general right of the connector, configuration properties, and so on: E:\study\toolsForVS2010\jsonPP\lib\release

3) You can then run the program to get release version of the program

Methods of compiling JSON libraries and importing third-party libraries in VS2010

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.