title: C++: include multiple header files with same name from different namespaces
body: <p>How do you solve created by including a header file with the same name as another header file already indirectly included as a result of another include?</p>
  
  <p>For instance:</p>
  
  <pre><code>// src/blah/a.hpp
  #ifndef A_HPP
  #define A_HPP
  
  namspace blah
  {
  
  class A
  {
  }
  
  }
  
  #endif
  
  // src/blah/b.hpp
  #ifndef B_HPP
  #define B_HPP
  
  #includes "a.hpp"
  
  namspace blah
  {
  
  class B
  {
  }
  
  }
  
  #endif
  
  // src/foo/a.hpp
  #ifndef A_HPP
  #define A_HPP
  
  namspace foo
  {
  
  class A
  {
  }
  
  }
  
  #endif
  
  // src/foo/c.hpp
  #ifndef C_HPP
  #define C_HPP
  
  #includes "../b.hpp"
  #includes "a.hpp"       // won't be included due to multiple inclusion prevention
  
  namspace foo
  {
  
  class C
  {
  }
  
  }
  
  #endif
  </code></pre>
  
  <p>In the last header file, a.hpp won't be included because of the multiple inclusion preprocessor guards.  Really, this should be okay though since the classes are in different namespaces.  I realize that the easy way is to just change the name of foo/a.hpp or to just give it a fake name in the multiple inclusion guard.  Is there a better way?</p>
  
  <p><strong>EDIT</strong>
  I understand that you can solve this problem by using a more descriptive name in the #define and #ifndef directives (e.g. FOO_A_HPP and BLAH_A_HPP), but I want to know if that is the recommended or best way.  Would some people recommend using a different file name as a better solution or does it not really matter?  Would you recommend using the convention:</p>
  
  <pre><code>&lt;NAMESPACE&gt;_&lt;CLASS&gt;_HPP
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>&lt;CLASS&gt;_HPP
  </code></pre>
  
  <p>to give a better chance of avoiding these problems in general?</p>