title: Boost iostreams with bzip - unresolved symbols
body: <p>My project was using an older version of Boost's iostreams w/ bzip2. I'm now trying to upgrade to Boost 1.51. At first I did not compile with bzip so obviously I got the linker yelling about libboost_bzip2-vc100-mt-sgd-1_51.lib being missing. I then followed <a href="https://stackoverflow.com/questions/7282645/how-to-build-boost-iostreams-with-gzip-and-bzip2-support-on-windows">these instructions</a> (and added the static flag) to compile this file.</p>
  
  <p>However, running the linker now returns a bunch of symbols missing:</p>
  
  <pre><code>&gt;error LNK2001: unresolved external symbol "protected: __thiscall boost::iostreams::detail::bzip2_base::~bzip2_base(void)" (??1bzip2_base@detail@iostreams@boost@@IAE@XZ)
  &gt;error LNK2001: unresolved external symbol "protected: __thiscall boost::iostreams::detail::bzip2_base::bzip2_base(struct boost::iostreams::bzip2_params const &amp;)" (??0bzip2_base@detail@iostreams@boost@@IAE@ABUbzip2_params@23@@Z)
  &gt;error LNK2001: unresolved external symbol "int const boost::iostreams::bzip2::stream_end" (?stream_end@bzip2@iostreams@boost@@3HB)
  ...
  </code></pre>
  
  <p>Any ideas how come the lib doesn't contain all this code? What am I missing?
  I'm using VS2010 on Windows.</p>
  
  <hr>
  
  <p>Edit: Got it!</p>
  
  <p>Had an old version of libboost_iostreams-vc100-mt-sgd-1_51.lib that was compiled without the bzip. What I'm still not sure about is this: For my original compilation I used:</p>
  
  <pre><code>&gt;b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 -sZLIB_SOURCE=d:\work\external\zlib-1.2.3 runtime-link=static
  </code></pre>
  
  <p>This produced the following files:</p>
  
  <pre><code>libboost_bzip2-vc100-mt-s-1_51.lib
  libboost_bzip2-vc100-mt-sgd-1_51.lib
  </code></pre>
  
  <p>For the "correct" compilation (that solved the problem) I used:</p>
  
  <pre><code>&gt;b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 runtime-link=static
  </code></pre>
  
  <p>I.e. simply removed the zlib, as it was unnecessary for me. It produced:</p>
  
  <pre><code>libboost_bzip2-vc100-mt-s-1_51.lib
  libboost_bzip2-vc100-mt-sgd-1_51.lib
  libboost_iostreams-vc100-mt-s-1_51.lib
  libboost_iostreams-vc100-mt-sgd-1_51.lib
  </code></pre>
  
  <p>How come the iostreams libs were not produced on the original compilation? Very odd.</p>
  
  <p>Thanks.</p>