#include<string>
#include<iostream>
#include<json/json.h>
#include<cpr/cpr.h>
using namespace std;
using namespace cpr;
int main() {
Response r = Get(Url{ "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" });
Json::Value data;
Json::Reader reader;
reader.parse(r.text, data);
cout << data << endl;
}
I'm trying to get print out the response {"Bitcoin" {"USD: 23000"}}.
When I just use response and cout r.text it runs perfectly. But when I use jsoncpp it says "There were build errors, would you like to run previous build?"
Build errors:
Build started... 1>------ Build started: Project: Project 1, Configuration: Debug x64 ------ 1>Main.obj : error LNK2019: unresolved external symbol "public: __cdecl Json::Value::Value(enum Json::ValueType)" (??0Value@Json@@QEAA@W4ValueType@1@@Z) referenced in function main 1>Main.obj : error LNK2019: unresolved external symbol "public: __cdecl Json::Value::~Value(void)" (??1Value@Json@@QEAA@XZ) referenced in function main 1>Main.obj : error LNK2019: unresolved external symbol "public: __cdecl Json::Reader::Reader(void)" (??0Reader@Json@@QEAA@XZ) referenced in function main 1>Main.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Json::Reader::parse(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class Json::Value &,bool)" (?parse@Reader@Json@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAVValue@2@_N@Z) referenced in function main 1>Main.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits > & __cdecl Json::operator<<(class std::basic_ostream<char,struct std::char_traits > &,class Json::Value const &)" (??6Json@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV12@AEBVValue@0@@Z) referenced in function main