title: Preventing multiple includes in C++
body: <p>i have 2 classes in different namespaces and both of them needs to include same Image.h class but when i include at the same time i get an error. Here my classes: </p>
  
  <p>FilterManager.h:</p>
  
  <pre><code>#ifndef FILTERMANAGER_H_
  #define FILTERMANAGER_H_
  
  #include "../Images/Image.h"
  namespace Filter {
  
  class FilterManager {
  public:
      Image* applyFilter(int filterType, PGMImage *pgmImage);
  
  };
  
  } /* namespace Filter */
  #endif /* FILTERMANAGER_H_ */
  </code></pre>
  
  <p>Main Application class : This includes Images/Image.h and Filter/FilterManager.h at the same time and i get an error.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;fstream&gt;
  #include &lt;stdio.h&gt;
  #include "Images/Image.h"
  #include "Filter/FilterManager.h"
  
  
  using namespace std;
  
  int main() {
  
      //new typename ImageIO::ImageIO;
  
      Images::Image *Image = NULL;
  
      Filter::FilterManager::getInstance();
  
      pgmImage = imageIO-&gt;readPGM("Resources/house.256.pgm");
  
      return 0;
  }
  </code></pre>
  
  <p>And Image.h class </p>
  
  <pre><code>#ifndef IMAGE_H_
  #define IMAGE_H_
  
  #include "Image.h"
  
  
  
  namespace Images {
  
  class Image {
  public:
      Image();
      virtual ~Image();
  
  
  private:
      int** imatrix(int nrl,int nrh,int ncl,int nch);
  };
  
  } /* namespace Image */
  #endif /* IMAGE_H_ */
  </code></pre>
  
  <p>Thanks for any help </p>