Does it mean search the previous folder for somefile.h or the project folder for somefile.h?
+2
A:
It means the parent directory of the directory the source file is in.
Ignacio Vazquez-Abrams
2010-03-29 21:17:30
+12
A:
It means that look for somefile.h
in the parent folder with respect to the source file where the include directive is found.
In *nix systems(thats where this convention came from AFAIK):
. manse the current directory.
.. means one level up from the current directory.
For example, if you have the following directories structure:
home
|
code
| src
| someOtherDirectory
Your source file could be in home/code/src
and you have:
#include "../somefile.h"
in your source code, then the compiler is going to look for somefile.h
in home/code/
AraK
2010-03-29 21:17:39
not just *nix, but DOS too
Kip
2010-03-29 21:25:52
@Kip Didn't DOS get that convention from oldish Unix systems also?
AraK
2010-03-29 21:29:22
Minor note - this isn't required by the standard to be the meaning of "..", it's just what it means in practice in pretty much any filesystem.
Steve Jessop
2010-03-29 21:54:58
@AraK: Yeah, I think so. I was just pointing out that it works that way in DOS too, as the statement "In *nix systems" makes it sound like it is unique to those systems.
Kip
2010-03-30 12:50:37
@Kip Sorry, my bad :)
AraK
2010-03-30 16:43:52
+3
A:
It means look in the parent directory for "somefile.h", relative to the directory the file containing the directive is in.
ChrisF
2010-03-29 21:17:51
A:
Well, if your source files are in /src
, then somefile.h
should be above src
or in /
Earlz
2010-03-29 21:18:18