Boost logo

Boost Users :

Subject: [Boost-users] need help using boost bzip2 filter on Windows (or zlib filter)
From: ChristinaDRS (mail_at_[hidden])
Date: 2009-10-21 15:12:56


Hello all,

I have the following code simple code to compress/uncompress a string:

#include <iostream>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filtering_stream.hpp>
using namespace std;

int main()
{
        string message = "this is a test message!";
        cout << "message: " << message << endl;
        string compressed;
        boost::iostreams::filtering_streambuf<boost::iostreams::output> out;
        out.push(boost::iostreams::zlib_compressor());
        out.push(boost::iostreams::back_inserter(compressed));
        boost::iostreams::copy(boost::make_iterator_range(message), out);
        cout << "compressed message: " << compressed << endl;

        boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
        in.push(boost::iostreams::zlib_decompressor());
        in.push(boost::make_iterator_range(compressed));
        string decompressed;
        boost::iostreams::copy(in, boost::iostreams::back_inserter(decompressed));
        cout << "decompressed message: " << decompressed << endl;
}

but I get the following linking error:

1>------ Build started: Project: bzip2_compression_test, Configuration:
Debug Win32 ------
1>Compiling...
1>bzip2_test.cpp
1>Linking...
1>LINK : fatal error LNK1104: cannot open file
'libboost_bzip2-vc90-mt-gd-1_39.lib'
1>Build log was saved at
"file://d:\compression\BoostCompression2\Debug\BuildLog.htm"
1>bzip2_compression_test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I tried following the instructions on this page:

http://www.boost.org/doc/libs/1_40_0/libs/iostreams/doc/installation.html

so I defined these environment variables:

BZIP2_BINARY = libbz2.lib
BZIP2_INCLUDE = D:\bzip2-1.0.5
BZIP2_LIBPATH = D:\bzip2-1.0.5\Debug
BZIP2_SOURCE = D:\bzip2-1.0.5

I also tried a similair example with zlib and I get the same error:

1>------ Build started: Project: libz_compression_test, Configuration: Debug
Win32 ------
1>Compiling...
1>zlib_test.cpp
1>Linking...
1>LINK : D:\Debug\libz_compression_test.exe not found or not built by the
last incremental link; performing full link
1>LINK : fatal error LNK1104: cannot open file
'libboost_zlib-vc90-mt-gd-1_39.lib'
1>Build log was saved at
"file://d:\\compression\libz_compression_test\Debug\BuildLog.htm"
1>libz_compression_test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any ideas how I can fix this?

Thanks!
Christina

-- 
View this message in context: http://www.nabble.com/need-help-using-boost-bzip2-filter-on-Windows-%28or-zlib-filter%29-tp25998463p25998463.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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