title: Question about include directory order in g++
body: <p>Somehow this is the first time I've ever encountered this problem in many years of programming, and I'm not sure what the options are for handling it.</p>
  
  <p>I am in the process of porting an application to Linux, and there is a header file in one of the directories that apparently has the same name as a header file in the standard C library, and when "cstdlib" is included from another file in that directory, it's trying to include the local file rather than the correct one from the standard library.</p>
  
  <p>In particular, the file is named "endian.h", which is trying to be included from /usr/include/bits/waitstatus.h. So instead of including /usr/include/bits/endian.h it is trying to include ./endian.h. makes no difference</p>
  
  <p>Is my only option to rename the endian.h in the project to something else, or is there a way that I can force the compiler to look in the same directory as the file that it's being included from first?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Okay it was just a stupid mistake on my part. My Makefile was setting -I. , so it was looking in the current directory first. D'oh.</p>