简体   繁体   中英

Build error in JSONCPP (Visual Studio2010)

I downloaded JSONCPP from GitHub. I included header file Json.h and wrote simple code as shown in picture. But i am getting link errors. Can you please help in using JSONCPP .

lINK ERROR: unresolved external symbol "public: __thiscall Json::Reader::Reader(void)" (??0Reader@Json@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'read''(void)" (??__Eread@@YAXXZ)[![MY code][1]][1]

#include "stdafx.h"
#include <json.h>

Json::Reader read;

int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

You are getting linker errors because json.h file contains only class and method definitions and no actual implementation. To resolve this problem you have to generate amalgamated source from the JsonCpp and include its files into your project. See Readme.md file in the project root for the additional info.

sonCpp is provided with a script to generate a single header and a single source file to ease inclusion into an existing project. The amalgamated source can be generated at any time by running the following command from the top-directory (this requires Python 2.6):

python amalgamate.py

Another option would be compiling JSONCPP source to the .lib file and use its with your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM