title: Compiler Warning C4251: Problem exporting a class in a *.dll
body: <p>EDIT: Forgive my noobish-ness, I haven't ever implemented a wrapper .dll before! :S</p>
  
  <p>I've been tinkering a bit with some of the recently released Kinect Sensor hacks (namely <a href="http://openkinect.org" rel="nofollow">OpenKinect</a> and <a href="http://www.openni.org/" rel="nofollow">OpenNI</a>) and I'm now trying to wrap the functionality in a *.dll for use in various "test" programs that I hope to write.</p>
  
  <p>So far I've set up a *.dll project and have got a lot of the library functionality in, however I'm getting C4251 compiler warnings all over the place.</p>
  
  <p>In the project settings I've got the <code>OpenNI.lib</code> file statically linked, so far my library header looks like this:</p>
  
  <pre><code>#ifdef LIBKINECT_EXPORTS
  #define LIBKINECT_API __declspec(dllexport)
  #else
  #define LIBKINECT_API __declspec(dllimport)
  #endif
  
  // This class is exported from the LibKinect.dll
  class LIBKINECT_API CLibKinect
  {
  public:
  
      CLibKinect(void);
      ~CLibKinect(void);
  
      bool Init(void);
  
  protected:
  
  private:
  
      xn::Context                     m_xContext;
      xn::DepthGenerator              m_xDepthGen;
  };
  </code></pre>
  
  <p>And my <code>stdafx.h</code> file contains:</p>
  
  <pre><code>#pragma once
  
  #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
  // Windows Header Files:
  #include &lt;windows.h&gt;
  
  #include &lt;XnOpenNI.h&gt;
  #include &lt;XnCodecIDs.h&gt;
  #include &lt;XnCppWrapper.h&gt;
  </code></pre>
  
  <p>Now I've attempted to create a windows console app to test the library and I get lots of <code>error C2653: 'xn' : is not a class or namespace name</code> errors. I was hoping that in the application I would only have to include and link to the wrapper *.dll not all of the OpenNI stuff as well, so as to hide the underlying implementation, is this incorrect?</p>