How to include headers located in project root compiling with GCC C++ compiler?
I want to tell GCC compiler to search for some header files in project root.
I do NOT want to make changes in code and use relative paths in #include directives - e.g. #include "../../myheader.h"
I compile source code I do not own and I do not want to maintain own version.
I do NOT want to specify absolute include path e.g. g++ -c -IC:\root_project_folder .. for obvious reasons.
I have tried: g++ -c -I .., g++ -c -I/ .. and g++ -c -I"/" .. but it does not work.
Please advise.
root_project_folder
|--myheader.h
|--src_folder
|-prog.cpp
src_foldertheng++ -I.. prog.ccis correct. Live Demo on coliru Otherwise, if you compile inroot_project_folderthen it isg++ -I. src_folder/prog.cc. Live Demo on coliru In both cases, I would use#include <myheader.h>. (#includewith double quotes, I wouldn't use if the header isn't expected in the same dir. like the source.) - Scheff's Cat-I.is the answer I was looking for. Thank you - T. Jastrzębski