Boost logo

Boost Users :

Subject: [Boost-users] [iostreams/filter] problem whilst linking
From: Christian Meesters (meesters_at_[hidden])
Date: 2010-06-01 10:59:15


Hi,

I have the following code (more or less ...)

<snip>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/copy.hpp>
<snip>

void function(...) {
   boost::iostreams::filtering_stream<boost::iostreams::input>
inputfile;
   std::ifstream istream(fname.c_str(), std::ios_base::in |
std::ios_base::binary);
   if (!istream) yamas::ioerror(fname);
   inputfile.push(boost::iostreams::gzip_decompressor());
   inputfile.push(istream);

   <snip>
   std::string line;
   std::getline(inputfile, line);

The code is compiling, yet when linking with

gcc -o program -static trunk/src/file1.cpp trunk/src/file2.cpp ...
-lboost_program_options -lboost_iostreams

I get

/usr/local/lib/libboost_iostreams.a(zlib.o): In function
`boost::iostreams::detail::zlib_base::after(char const*&, char*&,
bool)':
zlib.cpp:(.text+0x120): undefined reference to `crc32'
/usr/local/lib/libboost_iostreams.a(zlib.o): In function
`boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)':
zlib.cpp:(.text+0x77e): undefined reference to `inflateInit2_'
zlib.cpp:(.text+0x7b7): undefined reference to `deflateInit2_'
/usr/local/lib/libboost_iostreams.a(zlib.o): In function
`boost::iostreams::detail::zlib_base::reset(bool, bool)':
zlib.cpp:(.text+0x2d): undefined reference to `deflateReset'
zlib.cpp:(.text+0x49): undefined reference to `inflateEnd'
zlib.cpp:(.text+0x51): undefined reference to `inflateReset'
zlib.cpp:(.text+0x59): undefined reference to `deflateEnd'
/usr/local/lib/libboost_iostreams.a(zlib.o): In function
`boost::iostreams::detail::zlib_base::xinflate(int)':
zlib.cpp:(.text+0x64): undefined reference to `inflate'
/usr/local/lib/libboost_iostreams.a(zlib.o): In function
`boost::iostreams::detail::zlib_base::xdeflate(int)':
zlib.cpp:(.text+0x74): undefined reference to `deflate'
collect2: ld returned 1 exit status

Any idea what's wrong? What I need to change?

Christian

PS I tried not to be too verbose, however, if any info is missing,
please tell me.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net