I have a header file provided by yaml-cpp library, yaml.h
yaml.h:
#include "yaml-cpp/parser.h"
#include "yaml-cpp/emitter.h"
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/stlemitter.h"
#include "yaml-cpp/exceptions.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/impl.h"
#include "yaml-cpp/node/convert.h"
#include "yaml-cpp/node/iterator.h"
#include "yaml-cpp/node/detail/impl.h"
#include "yaml-cpp/node/parse.h"
#include "yaml-cpp/node/emit.h"
main.cpp
#include "./lib/yaml-cpp/include/yaml.h"
int main()
{
YAML::Node config = YAML::LoadFile("config.yaml");
return 0;
}
All the header files are in the same directory (/home/user/application/libs/yaml-cpp/include), but the compiler is unable to find parser.h and all the other includes. Why is this so and how do I fix it?
I have tried using g++ -I/home/user/application/libs/yaml-cpp/include main.cpp but that did not work.
I am on a linux environment. Everything works fine when the header files are kept in /usr/lib64, but I am not allowed to do that for this project.
#include "yaml-cpp/parser.h", i.e. do NOT look for them inside a "include" folder? I really recommend to create a minimal reproducible example with a self-created header-only-library. It would allow you to experiment with different installation file structures, include lines ... It would also make reproducing your problem easier for potential answerers. Apart from the fact that making a MRE is simply a good way for yourself to trace the relevant detials of your problem.