I m new on json, I trying to read my json file from this tutorial site https://en.wikibooks.org/wiki/JsonCpp
however I get some linker error
1>------ Build started: Project: TwilightAdventure, Configuration: Debug Win32 ------ 1> Creating library C:\Users\MinTeckNG\Desktop\TwilightAdventure\Debug\TwilightAdventure.lib and object C:\Users\MinTeckNG\Desktop\TwilightAdventure\Debug\TwilightAdventure.exp 1>LoadingMap.obj : error LNK2019: unresolved external symbol "public: __thiscall Json::Reader::Reader(void)" (??0Reader@Json@@QAE@XZ) referenced in function "public: void __thiscall LoadingMap::ReadJsonFileTest(void)" (?ReadJsonFileTest@LoadingMap@@QAEXXZ) 1>C:\Users\MinTeckNG\Desktop\TwilightAdventure\Debug\TwilightAdventure.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
error picture lnk2019 unresolved external symbol
{
"actors": [
{
"name": "Ground",
"pos": {
"x": 2592.0,
"y": 96.0
}
},
{
"name": "Grass",
"pos": {
"x": 2656.0,
"y": 96.0
}
}
}
my code
#include "LoadingMap.h"
#include <fstream>
LoadingMap::LoadingMap(void)
{
}
LoadingMap::~LoadingMap(void)
{
}
/*const char *LoadingMap::GetFileName(int stage, int difficulties)
{
char a = '0';
const char *ptr = &a;
return ptr;
}*/
/*void LoadingMap::ReadJsonFile(const char *filename)
{
}*/
void LoadingMap::ReadJsonFileTest()
{
std::ifstream ifs("1-1-0.json");
Json::Reader reader;
//Json::Value obj;
//reader.parse(ifs, obj);
//std::cout << "Object type: " << obj["name"].asString() << std::endl;
//const Json::Value& pos = obj["pos"];
//std::cout << " x: " << pos[0]["x"].asUInt();
//std::cout << " y: " << pos[1]["y"].asUInt();
}
my header file
#pragma once
#include <iostream>
#include <fstream>
#include <json/json.h>
class LoadingMap
{
public:
LoadingMap(void);
~LoadingMap(void);
//const char *GetFileName(int stage, int difficulties);
//void ReadJsonFile(const char *filename);
void ReadJsonFileTest();
private:
};
well the code is mainly nothing , nothing implement yet, all I try to follow the tutorial and modify .