Wrapping/hiding nlohmann::json implementation #3775
-
Hello, `` class Pjson public: and then in the .cpp there is `#include <Pjson.h> using Json = nlohmann::json; Pjson::Pjson() I have a weird error reference to 'json' is ambiguous is there any way out of it ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
namespace nlohmann { class json; } This is not a correct forward declaration. Please include |
Beta Was this translation helpful? Give feedback.
-
yes, right, correct when using the correct files, then, it works just wondering if we are making the whole "programming environment" a bit too fragile anyway, yes, thank you |
Beta Was this translation helpful? Give feedback.
-
I want to make your answer as a "solution" but I have the "mark answer" button on what I post and not on you post" .... weird |
Beta Was this translation helpful? Give feedback.
This is not a correct forward declaration. Please include
json_fwd.hpp
which forward declares the nlohmann JSON types correctly.