How to use boost iostream with zlib

Hi, Can you please tell me how can I use boost iostream with zlib to inflate an byte stream? Where can I find an example? Thank you.

Meryl Silverburgh wrote:
Hi,
Can you please tell me how can I use boost iostream with zlib to inflate an byte stream? Where can I find an example?
The library docs have some examples in them. See: http://boost.org/libs/iostreams/doc/index.html Navigate to the Quick Reference and click on the "basic_zlib_decompressor" filter link. At the bottom of the page you will see an example.

Thanks for the poniters.
From this example, how can I just pass not the whole file, but the file starting at the 5th byte to the end to zlib_decompressor()?
#include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp> int main() { using namespace std; ifstream file("hello.z", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(zlib_decompressor()); in.push(file); boost::iostreams::copy(in, cout); } On 7/4/07, eg <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Hi,
Can you please tell me how can I use boost iostream with zlib to inflate an byte stream? Where can I find an example?
The library docs have some examples in them. See: http://boost.org/libs/iostreams/doc/index.html
Navigate to the Quick Reference and click on the "basic_zlib_decompressor" filter link. At the bottom of the page you will see an example.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On 7/4/07, eg <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Hi,
Can you please tell me how can I use boost iostream with zlib to inflate an byte stream? Where can I find an example?
The library docs have some examples in them. See: http://boost.org/libs/iostreams/doc/index.html
Navigate to the Quick Reference and click on the "basic_zlib_decompressor" filter link. At the bottom of the page you will see an example.
I am having problems in compiling the example in the boost iostreams exmaple: code: #include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp> int main() { using namespace std; ifstream file("hello.z", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(zlib_decompressor()); in.push(file); boost::iostreams::copy(in, cout); } error: g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/boostTest.d" -MT"src/boostTest.d" -o"src/boostTest.o" "../src/boostTest.cpp" ../src/boostTest.cpp:18:2: warning: no newline at end of file ../src/boostTest.cpp: In function 'int main()': ../src/boostTest.cpp:13: error: 'filtering_streambuf' was not declared in this scope ../src/boostTest.cpp:13: error: 'input' was not declared in this scope ../src/boostTest.cpp:13: error: 'in' was not declared in this scope ../src/boostTest.cpp:14: error: 'zlib_decompressor' was not declared in this scope make: *** [src/boostTest.o] Error 1
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

I can successfully compile the code with the add of one "using" statement but the linker reports linker error. Code: // ... #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp> int main() { using namespace std; using namespace boost::iostreams; // Added this line. ifstream file("hello.z", ios_base::in | ios_base::binary); filtering_streambuf<input> in; // ... } Linker error: g++ -ozlib.exe -lboost_iostreams-mgw34-mt-1_34 zlib.cpp SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char>
::zlib_decompressor_impl(int)]+0x46):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0x66):zlib.cpp: undefined reference to `boost::iostreams::zlib::default_strategy' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0x7f):zlib.cpp: undefined reference to `boost::iostreams::zlib::deflated' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0x88):zlib.cpp: undefined reference to `boost::iostreams::zlib::default_compression' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0xff):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEED2Ev[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::~zlib_decompressor_impl()]+0x18):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail9zlib_base4initISaIcEEEvRKNS0_11zlib_paramsEbRNS1_14zlib_allocatorIT_NS1_21zlib_allocator_traitsIS9_E4typeEEE[void boost::iostreams::detail::zlib_base::init<std::allocator<char> (boost::iostreams::zlib_params const&, bool, boost::iostreams::detail::zlib_allocator<std::allocator<char>, boost::iostreams::detail::zlib_allocator_traits<std::allocator<char> ::type>&)]+0x67):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x2f):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::before(char const*&, char const*, char*&, char*)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x34):zlib.cpp: undefined reference to `boost::iostreams::zlib::sync_flush' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x43):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::inflate(int)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x67):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::after(char const*&, char*&, bool)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x72):zlib.cpp: undefined reference to `boost::iostreams::zlib_error::check(int)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x7b):zlib.cpp: undefined reference to `boost::iostreams::zlib::stream_end' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE5closeEv[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::close()]+0x1d):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
collect2: ld returned 1 exit status
Built using Boost 1.34 with Multi-threading support, MinGW g++ 3.42 On 06/07/07, Meryl Silverburgh <silverburgh.meryl@gmail.com> wrote:
On 7/4/07, eg <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Hi,
Can you please tell me how can I use boost iostream with zlib to inflate an byte stream? Where can I find an example?
The library docs have some examples in them. See: http://boost.org/libs/iostreams/doc/index.html
Navigate to the Quick Reference and click on the "basic_zlib_decompressor" filter link. At the bottom of the page you will see an example.
I am having problems in compiling the example in the boost iostreams exmaple:
code:
#include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp>
int main() { using namespace std;
ifstream file("hello.z", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(zlib_decompressor()); in.push(file); boost::iostreams::copy(in, cout); }
error:
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/boostTest.d" -MT"src/boostTest.d" -o"src/boostTest.o" "../src/boostTest.cpp" ../src/boostTest.cpp:18:2: warning: no newline at end of file ../src/boostTest.cpp: In function 'int main()': ../src/boostTest.cpp:13: error: 'filtering_streambuf' was not declared in this scope ../src/boostTest.cpp:13: error: 'input' was not declared in this scope ../src/boostTest.cpp:13: error: 'in' was not declared in this scope ../src/boostTest.cpp:14: error: 'zlib_decompressor' was not declared in this scope make: *** [src/boostTest.o] Error 1
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Regards, Ron Lau Life is wonderful because there are variables and unknowns.

Thanks. I just tried your idea on ubuntu and I get the linker errors too: g++ -o"boostTest" ./src/boostTest.o ./src/boostTest.o: In function `void boost::iostreams::detail::zlib_base::init<std::allocator<char>
(boost::iostreams::zlib_params const&, bool, boost::iostreams::detail::zlib_allocator<std::allocator<char>, boost::iostreams::detail::zlib_allocator_traits<std::allocator<char> ::type>&)': /usr/include/boost/iostreams/filter/zlib.hpp:182: undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)' ./src/boostTest.o: In function `zlib_decompressor_impl': /usr/include/boost/iostreams/filter/zlib.hpp:363: undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()' /usr/include/boost/iostreams/filter/zlib.hpp:365: undefined reference to `boost::iostreams::zlib::default_strategy' /usr/include/boost/iostreams/filter/zlib.hpp:365: undefined reference to `boost::iostreams::zlib::deflated' /usr/include/boost/iostreams/filter/zlib.hpp:365: undefined reference to `boost::iostreams::zlib::default_compression' /usr/include/boost/iostreams/filter/zlib.hpp:367: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' ./src/boostTest.o: In function `~zlib_decompressor_impl': /usr/include/boost/iostreams/filter/zlib.hpp:360: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)' /usr/include/boost/iostreams/filter/zlib.hpp:360: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' /usr/include/boost/iostreams/filter/zlib.hpp:360: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' ./src/boostTest.o: In function `boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::close()': /usr/include/boost/iostreams/filter/zlib.hpp:383: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)' ./src/boostTest.o: In function `boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)': /usr/include/boost/iostreams/filter/zlib.hpp:375: undefined reference to `boost::iostreams::detail::zlib_base::before(char const*&, char const*, char*&, char*)' /usr/include/boost/iostreams/filter/zlib.hpp:376: undefined reference to `boost::iostreams::zlib::sync_flush' /usr/include/boost/iostreams/filter/zlib.hpp:376: undefined reference to `boost::iostreams::detail::zlib_base::inflate(int)' /usr/include/boost/iostreams/filter/zlib.hpp:377: undefined reference to `boost::iostreams::detail::zlib_base::after(char const*&, char*&, bool)' /usr/include/boost/iostreams/filter/zlib.hpp:378: undefined reference to `boost::iostreams::zlib_error::check(int)' /usr/include/boost/iostreams/filter/zlib.hpp:379: undefined reference to `boost::iostreams::zlib::stream_end'
collect2: ld returned 1 exit status make: *** [boostTest] Error 1
On 7/6/07, Ron Lau <ronyclau@gmail.com> wrote:
I can successfully compile the code with the add of one "using" statement but the linker reports linker error.
Code:
// ... #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp>
int main() { using namespace std; using namespace boost::iostreams; // Added this line. ifstream file("hello.z", ios_base::in | ios_base::binary); filtering_streambuf<input> in; // ... }
Linker error: g++ -ozlib.exe -lboost_iostreams-mgw34-mt-1_34 zlib.cpp SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char>
::zlib_decompressor_impl(int)]+0x46):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0x66):zlib.cpp: undefined reference to `boost::iostreams::zlib::default_strategy' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0x7f):zlib.cpp: undefined reference to `boost::iostreams::zlib::deflated' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0x88):zlib.cpp: undefined reference to `boost::iostreams::zlib::default_compression' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEEC2Ei[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::zlib_decompressor_impl(int)]+0xff):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEED2Ev[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::~zlib_decompressor_impl()]+0x18):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail9zlib_base4initISaIcEEEvRKNS0_11zlib_paramsEbRNS1_14zlib_allocatorIT_NS1_21zlib_allocator_traitsIS9_E4typeEEE[void boost::iostreams::detail::zlib_base::init<std::allocator<char> (boost::iostreams::zlib_params const&, bool, boost::iostreams::detail::zlib_allocator<std::allocator<char>, boost::iostreams::detail::zlib_allocator_traits<std::allocator<char> ::type>&)]+0x67):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x2f):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::before(char const*&, char const*, char*&, char*)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x34):zlib.cpp: undefined reference to `boost::iostreams::zlib::sync_flush' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x43):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::inflate(int)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x67):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::after(char const*&, char*&, bool)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x72):zlib.cpp: undefined reference to `boost::iostreams::zlib_error::check(int)' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE6filterERPKcS6_RPcS8_b[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::filter(char const*&, char const*, char*&, char*, bool)]+0x7b):zlib.cpp: undefined reference to `boost::iostreams::zlib::stream_end' SOME/PATH/HERE/ccW0caaa.o(.text$_ZN5boost9iostreams6detail22zlib_decompressor_implISaIcEE5closeEv[boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> ::close()]+0x1d):zlib.cpp: undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
collect2: ld returned 1 exit status
Built using Boost 1.34 with Multi-threading support, MinGW g++ 3.42
On 06/07/07, Meryl Silverburgh <silverburgh.meryl@gmail.com > wrote:
On 7/4/07, eg <egoots@gmail.com > wrote:
Meryl Silverburgh wrote:
Hi,
Can you please tell me how can I use boost iostream with zlib to inflate an byte stream? Where can I find an example?
The library docs have some examples in them. See: http://boost.org/libs/iostreams/doc/index.html
Navigate to the Quick Reference and click on the "basic_zlib_decompressor" filter link. At the bottom of the page you will see an example.
I am having problems in compiling the example in the boost iostreams
exmaple:
code:
#include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp>
int main() { using namespace std;
ifstream file("hello.z", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(zlib_decompressor()); in.push (file); boost::iostreams::copy(in, cout); }
error:
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/boostTest.d" -MT"src/boostTest.d" -o"src/boostTest.o" "../src/boostTest.cpp" ../src/boostTest.cpp:18:2: warning: no newline at end of file ../src/boostTest.cpp: In function 'int main()': ../src/boostTest.cpp:13: error: 'filtering_streambuf' was not declared in this scope ../src/boostTest.cpp:13: error: 'input' was not declared in this scope ../src/boostTest.cpp:13: error: 'in' was not declared in this scope ../src/boostTest.cpp:14: error: 'zlib_decompressor' was not declared in this scope make: *** [src/boostTest.o] Error 1
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Regards, Ron Lau
Life is wonderful because there are variables and unknowns. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Meryl Silverburgh wrote:
Thanks. I just tried your idea on ubuntu and I get the linker errors too:
Just checking... did you build boost with zlib support enabled? See the "Installation" section which describes what is required: http://www.boost.org/libs/iostreams/doc/index.html

Oh, I didn't know that I have to explicitly enable the support when compiling under Windows. It is working after I've recompiled the library. Thx! On 07/07/07, egoots <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Thanks. I just tried your idea on ubuntu and I get the linker errors too:
Just checking... did you build boost with zlib support enabled?
See the "Installation" section which describes what is required: http://www.boost.org/libs/iostreams/doc/index.html
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Regards, Ron Lau Life is wonderful because there are variables and unknowns.

On 7/6/07, egoots <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Thanks. I just tried your idea on ubuntu and I get the linker errors too:
Just checking... did you build boost with zlib support enabled?
See the "Installation" section which describes what is required: http://www.boost.org/libs/iostreams/doc/index.html
I install the boost iostream library from ubuntu repository. And I check with ubuntu forum, and i get a response saying it has zlib support.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Sorry, I have forgotten to write down the steps I have done. After I have recompiled my iostreams library with zlib support, I have added a line in the source code. // ... #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/zlib.hpp> #include "/boost_1_34_0/libs/iostreams/src/zlib.cpp" // New included file added. int main() { // ... details } That line is required as the implementation details of some zlib-related functions is placed in that file. Although it is reported that in this post : " http://thread.gmane.org/gmane.comp.lib.boost.user/16525/focus=16587", statically-linked library under Windows does not require that line, I've got those linker errors without it, as you did under Linux. And though the Installation guide from the official documentation states that we have to define "BOOST_IOSTREAMS_NO_LIB" too, I can compile the source code successfully without it. Also, I have changed my command for compilation a bit. Command: g++ -ozlib.exe -lboost_zlib-mgw34-mt-1_34 -lboost_iostreams-mgw34-mt-1_34 zlib.cpp Built using statically-linked Boost 1.34 with Multi-threading, zlib, bzip2 support, MinGW g++ 3.42 Meryl Silverburgh wrote:
I install the boost iostream library from ubuntu repository. And I check with ubuntu forum, and i get a response saying it has zlib support.
-- Regards, Ron Lau Life is wonderful because there are variables and unknowns.

Meryl Silverburgh wrote:
On 7/6/07, egoots <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Thanks. I just tried your idea on ubuntu and I get the linker errors too:
Just checking... did you build boost with zlib support enabled?
See the "Installation" section which describes what is required: http://www.boost.org/libs/iostreams/doc/index.html
I install the boost iostream library from ubuntu repository. And I check with ubuntu forum, and i get a response saying it has zlib support.
did you include zlib.cpp (from iostreams) in your project? It explains that on the above mentioned install page too

On 7/7/07, egoots <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
On 7/6/07, egoots <egoots@gmail.com> wrote:
Meryl Silverburgh wrote:
Thanks. I just tried your idea on ubuntu and I get the linker errors too:
Just checking... did you build boost with zlib support enabled?
See the "Installation" section which describes what is required: http://www.boost.org/libs/iostreams/doc/index.html
I install the boost iostream library from ubuntu repository. And I check with ubuntu forum, and i get a response saying it has zlib support.
did you include zlib.cpp (from iostreams) in your project? It explains that on the above mentioned install page too
But when i include zlib.cpp to my project, i cant' get zlib.cpp to compile: /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:178: undefined reference to `deflateInit2_' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:178: undefined reference to `inflateInit2_' ./src/zlib.o: In function `boost::iostreams::detail::zlib_base::reset(bool, bool)': /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `deflateReset' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `inflateReset' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `deflateEnd' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `inflateEnd'
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Meryl Silverburgh wrote:
On 7/7/07, egoots <egoots@gmail.com> wrote: .
But when i include zlib.cpp to my project, i cant' get zlib.cpp to compile:
/home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:178: undefined reference to `deflateInit2_' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:178: undefined reference to `inflateInit2_' ./src/zlib.o: In function `boost::iostreams::detail::zlib_base::reset(bool, bool)': /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `deflateReset' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `inflateReset' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `deflateEnd' /home/silverburgh/workspace/urlTest/Debug/../src/zlib.cpp:145: undefined reference to `inflateEnd'
Well those are all exports from the zlib library (not zlib.cpp) so something isnt being linked in somehow. My build is on windows, so I am not much help with Ubuntu setup issues here.
participants (4)
-
eg
-
egoots
-
Meryl Silverburgh
-
Ron Lau