title: Compiling DLL in Microsoft Visual C++ 2015 -- warning C4251 needs to have dll-interface to be used by clients of class -- when using Boost?
body: <p>So, I'm trying to compile a DLL for a large project of of mine. The idea is for it to have several parts. A library, of sorts, which gets compiled into a DLL, and an application that the DLL gets linked into. I keep getting the following warning: </p>
  
  <pre><code>warning C4251: 'plf::lfInvalidIndexExcpt::message': class 'boost::container::basic_string&lt;char,std::char_traits&lt;char&gt;,boost::container::new_allocator&lt;char&gt;&gt;' needs to have dll-interface to be used by clients of class 'plf::lfInvalidIndexExcpt'
  </code></pre>
  
  <p>Here is the code that has been giving me trouble.</p>
  
  <p>I have my DLL export/import macro defined as follows:</p>
  
  <pre><code>#ifdef LF_ENGINE_EXPORTS  
  #define LFE_API __declspec(dllexport)   
  #else  
  #define LFE_API __declspec(dllimport)   
  #endif  
  </code></pre>
  
  <p>Now, I'm using boost with my <em>library</em> and at one point I have the following:</p>
  
  <pre><code>typedef boost::container::string lfString;
  </code></pre>
  
  <p>The class lfInvalidIndexExcpt is defined like this:</p>
  
  <pre><code>namespace plf
  {
      class LFE_API lfInvalidIndexExcpt
      {
      public:
  
          explicit lfInvalidIndexExcpt(lfSize idx);
  
          lfInvalidIndexExcpt(lfSize idx, const lfString&amp; descr);
  
          const char* what() const throw();
  
      private:
  
          lfString message;
  
          void makeMessage(lfSize idx, const lfString&amp; descr);
  
      };
  };
  </code></pre>
  
  <p>I should probably mention that lfSize is just a typedef for std::size_t.</p>
  
  <p>All I'm wondering is what this warning actually means and if I can use Boost like this in my DLL, if at all. Also, if this is not the proper way to use Boost what is?</p>
  
  <p>Thanks,</p>
  
  <p>-Zack Frost</p>