-
Hey guys, I have read the steps detailed here, but cannot seem to get it working. Here is my entire program. (I have also tried it manually defining the functions, not using macros). I am using version 3.9.1. #include "json.hpp"
#include <iostream>
#include <fstream>
using json = nlohmann::json;
struct Tile
{
std::string name;
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Tile, name);
};
int main()
{
std::ifstream i("tiles.json", std::ifstream::in);
json j;
i >> j;
auto tiles = j.get<Tile>();
} And here are the errors being generated. I have been fiddling with this for hours now before breaking it out into a small project like this and cannot figure out if I missed anything. Please help! =] Severity Code Description Project File Line Suppression State
Error (active) E0304 no instance of overloaded function "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::get [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool, NumberIntegerType=int64_t, NumberUnsignedType=uint64_t, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer, BinaryType=std::vector<uint8_t, std::allocator<uint8_t>>]" matches the argument list JsonTest C:\Users\mries\Desktop\JsonTest\JsonTest\main.cpp 19
Error C2672 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>>::get': no matching overloaded function found JsonTest C:\Users\mries\Desktop\JsonTest\JsonTest\main.cpp 19
Error C2783 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>> nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer,std::vector<uint8_t,std::allocator<uint8_t>>>::get(void) const': could not deduce template argument for '__formal' JsonTest C:\Users\mries\Desktop\JsonTest\JsonTest\main.cpp 19 |
Beta Was this translation helpful? Give feedback.
Answered by
nlohmann
Nov 29, 2020
Replies: 1 comment 3 replies
-
Can you share the content of tiles.json? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
mries92
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you share the content of tiles.json?