Replies: 3 comments 11 replies
-
You declared this constructor in the class: ParameterValuesData(nlohmann::json json); But if you do not provide a definition (i.e. an actual implementation of this constructor) somewhere in your .cpp file, or forget to compile that file into the project, the linker will fail. This is true even if other constructors are defined and used elsewhere. Furthermore, this issue only happens in translation units that reference that specific constructor, which explains why most of your project compiles normally and only fails on NeaEngineClient.obj. |
Beta Was this translation helpful? Give feedback.
-
@gregmarr @nlohmann Is there a way to indicate that in my code I want to use 3.12.0? |
Beta Was this translation helpful? Give feedback.
-
Well, I tried several definition options. Using the 3.12.0 namespace define or using nlohmann::json_abi_v3_12_0::basic_json directly. But both gave compilation errors. After several tests, I discovered what causes the problem. If I include a libhv header before nlohmann/json.hpp, json.hpp (3.9.1) is used, which is inside libhv, and therefore nlohmann/json.hpp is ignored because INCLUDE_NLOHMANN_JSON_HPP_ is already defined. I solved it by ensuring that nlohmann/json.hpp is always included before any libhv include to force the most recent version to be used. It's a bit annoying, because any carelessness in the order of the includes can cause the problem, and identifying where the incorrect order is is not trivial in a large project like mine. I also understand that this is a flaw in libhv, which adds json.hpp as an internal header and not as an external library. In addition to the fact that it does not update the library over time. Thank you for everyone's help and availability. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I'm experiencing some link errors similar to the error below:
The error occurs in the constructor of this class:
This class is used in several objects in the project and they all compile normally. However, in one specific object (NeaEngineClient.obj), this link error appears.
I've seen this problem occur in several points of the project, always in methods that return JSON or methods that receive JSON as a parameter. I couldn't identify the reason.
I would like to know if anyone has experienced this and has any suggestions as to what it could be.
If you remove "nlohmann::json json" from the constructor and replace it with "std::string", everything compiles normally.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions