title: Including OpenVDB in DLL; Linking errors with Visual Studio 2015
body: <p>I am trying to compile, in Visual Studio 2015, a DLL that I am making which acts as a C-compatible wrapper around some functionality from OpenVDB, making it usable in an existing C project. When I build, however, I get the following Linker Errors:</p>
  
  <pre><code>Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr&lt;class std::basic_streambuf&lt;char,struct std::char_traits&lt;char&gt; &gt; &gt; __thiscall openvdb::v4_0_1::io::MappedFile::createBuffer(void)const " (__imp_?createBuffer@MappedFile@io@v4_0_1@openvdb@@QBE?AV?$shared_ptr@V?$basic_streambuf@DU?$char_traits@D@std@@@std@@@std@@XZ) referenced in function "private: void __thiscall openvdb::v4_0_1::tree::LeafBuffer&lt;float,3&gt;::doLoad(void)const " (?doLoad@?$LeafBuffer@M$02@tree@v4_0_1@openvdb@@ABEXXZ)
  
  Error   LNK2019 unresolved external symbol "__declspec(dllimport) class std::shared_ptr&lt;class openvdb::v4_0_1::io::StreamMetadata&gt; __cdecl openvdb::v4_0_1::io::getStreamMetadataPtr(class std::ios_base &amp;)" (__imp_?getStreamMetadataPtr@io@v4_0_1@openvdb@@YA?AV?$shared_ptr@VStreamMetadata@io@v4_0_1@openvdb@@@std@@AAVios_base@5@@Z) referenced in function "void __cdecl openvdb::v4_0_1::io::readCompressedValues&lt;float,class openvdb::v4_0_1::util::NodeMask&lt;3&gt; &gt;(class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,float *,unsigned int,class openvdb::v4_0_1::util::NodeMask&lt;3&gt; const &amp;,bool)" (??$readCompressedValues@MV?$NodeMask@$02@util@v4_0_1@openvdb@@@io@v4_0_1@openvdb@@YAXAAV?$basic_istream@DU?$char_traits@D@std@@@std@@PAMIABV?$NodeMask@$02@util@12@_N@Z)
  
  Error   LNK2019 unresolved external symbol "__declspec(dllimport) void __cdecl openvdb::v4_0_1::io::setStreamMetadataPtr(class std::ios_base &amp;,class std::shared_ptr&lt;class openvdb::v4_0_1::io::StreamMetadata&gt; &amp;,bool)" (__imp_?setStreamMetadataPtr@io@v4_0_1@openvdb@@YAXAAVios_base@std@@AAV?$shared_ptr@VStreamMetadata@io@v4_0_1@openvdb@@@5@_N@Z) referenced in function "private: void __thiscall openvdb::v4_0_1::tree::LeafBuffer&lt;float,3&gt;::doLoad(void)const " (?doLoad@?$LeafBuffer@M$02@tree@v4_0_1@openvdb@@ABEXXZ)
  
  Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: static class std::shared_ptr&lt;class openvdb::v4_0_1::math::Transform&gt; __cdecl openvdb::v4_0_1::math::Transform::createLinearTransform(class openvdb::v4_0_1::math::Mat4&lt;double&gt; const &amp;)" (__imp_?createLinearTransform@Transform@math@v4_0_1@openvdb@@SA?AV?$shared_ptr@VTransform@math@v4_0_1@openvdb@@@std@@ABV?$Mat4@N@234@@Z) referenced in function "public: static class std::shared_ptr&lt;class openvdb::v4_0_1::math::Transform&gt; __cdecl OpenVDB_c::LinearTransform(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)" (?LinearTransform@OpenVDB_c@@SA?AV?$shared_ptr@VTransform@math@v4_0_1@openvdb@@@std@@NNNNNNNNNNNNNNNN@Z)
  
  Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: void __thiscall openvdb::v4_0_1::GridBase::setTransform(class std::shared_ptr&lt;class openvdb::v4_0_1::math::Transform&gt;)" (__imp_?setTransform@GridBase@v4_0_1@openvdb@@QAEXV?$shared_ptr@VTransform@math@v4_0_1@openvdb@@@std@@@Z) referenced in function __catch$?setGridTransform@OpenVDB_c@@QAE_NHV?$shared_ptr@VTransform@math@v4_0_1@openvdb@@@std@@@Z$0
  
  Error   LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr&lt;class openvdb::v4_0_1::GridBase&gt; __thiscall openvdb::v4_0_1::io::File::readGrid(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;)" (__imp_?readGrid@File@io@v4_0_1@openvdb@@QAE?AV?$shared_ptr@VGridBase@v4_0_1@openvdb@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@6@@Z) referenced in function "public: int __thiscall OpenVDB_c::readGrid(int,char *)" (?readGrid@OpenVDB_c@@QAEHHPAD@Z)
  
  Error   LNK2001 unresolved external symbol "public: virtual class std::shared_ptr&lt;class openvdb::v4_0_1::io::Archive&gt; __thiscall openvdb::v4_0_1::io::File::copy(void)const " (?copy@File@io@v4_0_1@openvdb@@UBE?AV?$shared_ptr@VArchive@io@v4_0_1@openvdb@@@std@@XZ)
  
  Error   LNK2001 unresolved external symbol "public: virtual void __thiscall openvdb::v4_0_1::io::File::write(class std::vector&lt;class std::shared_ptr&lt;class openvdb::v4_0_1::GridBase const &gt;,class std::allocator&lt;class std::shared_ptr&lt;class openvdb::v4_0_1::GridBase const &gt; &gt; &gt; const &amp;,class openvdb::v4_0_1::MetaMap const &amp;)const " (?write@File@io@v4_0_1@openvdb@@UBEXABV?$vector@V?$shared_ptr@$$CBVGridBase@v4_0_1@openvdb@@@std@@V?$allocator@V?$shared_ptr@$$CBVGridBase@v4_0_1@openvdb@@@std@@@2@@std@@ABVMetaMap@34@@Z)
  
  Error   LNK2001 unresolved external symbol "__declspec(dllimport) private: static union half::uif const * const half::_toFloat" (__imp_?_toFloat@half@@0QBTuif@1@B) C:\Users\t00001657\documents\visual studio 2015\Projects\OVDBC\OVDBC\ovdbc.obj  1
  </code></pre>
  
  <p>OpenVDB and all of its dependencies are in the include folder, whose directory is added to additional include directories, and this is my current list of Additional Dependencies under the Linker options:</p>
  
  <ul>
  <li>blosc.lib</li>
  <li>cppunit.lib</li>
  <li>glew32.lib</li>
  <li>glfw3.lib</li>
  <li>Half.lib</li>
  <li>Iex-2_2.lib</li>
  <li>IexMath-2_2.lib</li>
  <li>IlmImf-2_2.lib</li>
  <li>IlmImfUtil-2_2.lib</li>
  <li>IlmThread-2_2.lib</li>
  <li>Imath2_2.lib</li>
  <li>openvdb.lib</li>
  <li>tbb.lib</li>
  <li>tbb_debug.lib</li>
  <li>tbb_preview.lib</li>
  <li>tbb_preview_debug.lib</li>
  <li>tbbmalloc.lib</li>
  <li>tbbmalloc_debug.lib</li>
  <li>tbbproxy.lib</li>
  <li>zlibstaticd.lib</li>
  </ul>
  
  <p>I can't seem to find any information on compiling with OpenVDB in Visual Studio that covers this kind of error, and am pretty stumped as to what I could be forgetting.</p>