title: What is the best way to organize headers in C++?
body: <p>I'm looking for the most portable and most organized way to include headers in C++. I'm making a game, and right now, my project structure looks like this:</p>
  
  <pre><code>game
  | util
  | | foo.cpp
  | | foo.h
  | ...
  game-client
  | main.cpp
  | graphics
  | | gfx.cpp
  | | gfx.h
  | ...
  game-server
  | main.cpp
  | ...
  </code></pre>
  
  <p>Say I want to include foo.h from gfx.cpp. As far as I know, there are 3 ways to do this:</p>
  
  <ol>
  <li><p><code>#include "../../game/util/foo.h</code>. This is what I'm currently doing, but it gets messier the deeper into the folder structure I go.</p></li>
  <li><p><code>#include "foo.h"</code>. My editor (Xcode) compiles fine with just this, but I'm not sure about other compilers.</p></li>
  <li><p><code>#include "game/util/foo.h"</code>, and adding the base directory to the include path.</p></li>
  </ol>
  
  <p>Which one is the best? (most portable, most organized, scales the best with many folders, etc.)</p>