views:

127

answers:

4

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
+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
not just *nix, but DOS too
Kip
@Kip Didn't DOS get that convention from oldish Unix systems also?
AraK
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
@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
@Kip Sorry, my bad :)
AraK
+3  A: 

It means look in the parent directory for "somefile.h", relative to the directory the file containing the directive is in.

ChrisF
A: 

Well, if your source files are in /src, then somefile.h should be above src or in /

Earlz