title: compiling boost with zlib on Linux
body: <p>I am trying to compile a code that uses Boost's zlib wrappers.  However, no matter what I do, I can't get this to work.</p>
  
  <p>In my cpp file, I have the following headers:</p>
  
  <pre><code>#include &lt;algorithm&gt;
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  #include &lt;boost/archive/binary_oarchive.hpp&gt;
  #include &lt;boost/archive/binary_iarchive.hpp&gt;
  #include &lt;boost/serialization/vector.hpp&gt;
  #include &lt;boost/iostreams/filter/zlib.hpp&gt;
  #include &lt;boost/iostreams/filtering_stream.hpp&gt;
  </code></pre>
  
  <p>I am compiling using command:</p>
  
  <pre><code>g++ -O3 -ffast-math -funroll-loops -ansi -pedantic-errors -L/usr/lib -lboost_filesystem -lboost_serialization -lz -I /usr/include/boost -o zlib_test zlib_test.o
  </code></pre>
  
  <p>Boost itself was built with bjam after running command:</p>
  
  <pre><code>./bootstrap.sh --prefix=/home/anon/boost --with-libraries=filesystem,program_options,system,serialization
  </code></pre>
  
  <p>The error message I am getting is the following:</p>
  
  <pre><code>zlib_test.o: In function `boost::detail::sp_counted_impl_p&lt;boost::iostreams::symmetric_filter&lt;boost::iostreams::detail::zlib_compressor_impl&lt;std::allocator&lt;char&gt; &gt;, std::allocator&lt;char&gt; &gt;::impl&gt;::dispose()':
  zlib_test.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv[boost::detail::sp_counted_impl_p&lt;boost::iostreams::symmetric_filter&lt;boost::iostreams::detail::zlib_compressor_impl&lt;std::allocator&lt;char&gt; &gt;, std::allocator&lt;char&gt; &gt;::impl&gt;::dispose()]+0x30): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
  </code></pre>
  
  <p>etc....</p>
  
  <p>Any ideas on how I can get this code to compile?  If it matters, this is on a Centos 5 machine.</p>