Before I start off, please bear with me, I'm very new to cpp with no formal training, and this question may have been asked and answered already, but I'm not sure what to call anything.
So I have a cpp program where I want to use this open source google sling package in. I have the google sling package in the same directory as my main.cpp program, and I can include one header with the path relative to the program, but that header(A) calls other headers(B:) within the package and the relative path to those headers(B:) is not relative to that header(A) file. Here is the error stack:
name@name-ThinkCentre-M83:~/Desktop/c++coding_projects/test_project$ g++ -Isling main.cpp
In file included from main.cpp:7:0:
sling/frame/object.h:25:10: fatal error: sling/base/logging.h: No such file or directory
#include "sling/base/logging.h"
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
name@name-ThinkCentre-M83:~/Desktop/c++coding_projects/test_project$ ls
bin obj test_project.cbp test_project.layout
main.cpp sling test_project.depend text_testfiles
name@name-ThinkCentre-M83:~/Desktop/c++coding_projects/test_project$ vim main.cpp
name@name-ThinkCentre-M83:~/Desktop/c++coding_projects/test_project$ cd sling/base
name@name-ThinkCentre-M83:~/Desktop/c++coding_projects/test_project/sling/base$ ls
bitcast.h flags.cc libinit.cc port.h status.cc types.h
BUILD flags.h logging.cc registry.cc status.h
clock.cc init.cc logging.h registry.h strtoint.cc
clock.h init.h macros.h slice.h strtoint.h
So sling/base/logging.h
is actually there, but since it's being called from sling/frame/object.h
, the correct relative path would be ../base/logging.h
(at least my limited knowledge tells me so). I think I have to set it up so that it's part of the global path that my cpp compiler searches in for dependencies. Either way I've done something terribly wrong.
I'm looking for a semi quick fix, but also I'd like to avoid this in the future, so a link to the appropriate information would be very much appreciated as well.
Edit:
Also tried with same error:
g++ -I.sling main.cpp
g++ -Itest_project main.cpp
g++ -isystem sling main.cpp
g++ -iwithprefixbefore "/home/.../test_project/" main.cpp
where ... is the path from home to my test project