title: C++ custom class limited functionality
body: <p>Let's say I have a custom class defined, there's a function inside the class that I want to use if and only if another header file is defined in main application.</p>
  
  <p>In another words: I do not want to use certain functionality from custom defined class unless a special header file is included in main application.</p>
  
  <p>If I would have my custom class definition inside main app. then I would use <code>#ifdef _SOME_STUFF_H</code> and <code>#endif</code>. This doesn't work inside header file (why would it I guess?).</p>
  
  <p>The question itself: am I trying to achieve something that is a complete non-sense and should simply include all required headers?</p>
  
  <p>Apologies if problem does not sound completely clear.</p>
  
  <p>Code example of class (assuming class is defined in main app.):</p>
  
  <pre><code>class someClass
  {
  public:
      void doThis();
  
      #ifdef _SOME_HEADER_H
      //uses stuff from some_header.h
      void doThat();
      #endif
  };
  
  void someClass::doThis()
  {}
  
  #ifdef _SOME_HEADER_H
  //uses stuff from some_header.h
  void someClass::doThat()
  {}
  #endif
  </code></pre>
  
  <p>Compilies and works fine, etc.</p>
  
  <p>In case we separate class to header and source we would include someClass in main.</p>
  
  <p>If I would build the solution when custom class is in the main app. it would compile whether some_stuff.h is included or not (as it should).
  If I would build it the other way (not including some_stuff.h in custom-class header but including it in main app.) it gives "unresolved external symbol".</p>