jeudi 22 août 2019

Include hpp in cpp file works but fails in header file

I'm using the nlohmann/json library in my code. I've used it with no problems by adding #include <nlohmann/json.hpp> in my .cpp files. If I move the include to a header file I get the error:

C1083 Cannot open include file: 'nlohmann/json.hpp': No such file or directory

Why does it work fine when included in a .cpp file but fails when included in a header file?

I want to have a struct that has a nlohmann::json object as a member variable, which is why I need it to work in the header.

I am using Visual Studio 2017 with the v140 compiler. The library nlohmann/json was installed using the conan package manager with the conanfile.txt below:

[requires]
jsonformoderncpp/3.6.1@vthiery/stable

[generators]
visual_studio

Aucun commentaire:

Enregistrer un commentaire