Let's say for argument's sake I have some code that is structured like
c:\projects\myapp - main.c global.h
c:\projects\myapp\subsection\somemorecode.c somemorecode.h
Now I want somemorecode.h to #include global.h, which is in the parent directory.
I could use #include <c:\\projects\myapp\global.h> but I don't want hard coded paths
rather I would like to add a search path to the compiler
eg
gcc -o -Ic:\projects\myapp\ main.exe main.c
However it still can't find the header.
What am I doing wrong? Why even though the search path is specified can it still not find the global.h?
c:\projects\myapp - main.c global.h
c:\projects\myapp\subsection\somemorecode.c somemorecode.h
Now I want somemorecode.h to #include global.h, which is in the parent directory.
I could use #include <c:\\projects\myapp\global.h> but I don't want hard coded paths
rather I would like to add a search path to the compiler
eg
gcc -o -Ic:\projects\myapp\ main.exe main.c
However it still can't find the header.
What am I doing wrong? Why even though the search path is specified can it still not find the global.h?

Comment