need help using boost bzip2 filter on Windows (or zlib filter)
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-zl... Sent from the Boost - Users mailing list archive at Nabble.com.
AMDG ChristinaDRS wrote:
I have the following code simple code to compress/uncompress a string: <snip> 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 ==========
<snip>
Any ideas how I can fix this?
Does the file libboost_bzip2-vc90-mt-gd-1_39.lib exist? Have you set the library path in the IDE? In Christ, Steven Watanabe
Hello Steven, No that file does not exist. I thought I could just link to my normal bzip2 or zlib library I built myself? I tried setting BOOST_ALL_NO_LIB to 1 so it would not autolink, but now I get these errors on my zlib test program: 1>------ Build started: Project: libz_compression_test, Configuration: Debug Win32 ------ 1>Linking... 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::default_compression" (?default_compression@zlib@iostreams@boost@@3HB) 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::deflated" (?deflated@zlib@iostreams@boost@@3HB) 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::default_strategy" (?default_strategy@zlib@iostreams@boost@@3HB) 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: __thiscall boost::iostreams::detail::zlib_base::~zlib_base(void)" (??1zlib_base@detail@iostreams@boost@@IAE@XZ) referenced in function __unwindfunclet$??0?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE@ABUzlib_params@23@@Z$0 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: __thiscall boost::iostreams::detail::zlib_base::zlib_base(void)" (??0zlib_base@detail@iostreams@boost@@IAE@XZ) referenced in function "public: __thiscall boost::iostreams::detail::zlib_compressor_impl<class std::allocator<char> >::zlib_compressor_impl<class std::allocator<char>
(struct boost::iostreams::zlib_params const &)" (??0?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE@ABUzlib_params@23@@Z) 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: void __thiscall boost::iostreams::detail::zlib_base::reset(bool,bool)" (?reset@zlib_base@detail@iostreams@boost@@IAEX_N0@Z) referenced in function "public: __thiscall boost::iostreams::detail::zlib_compressor_impl<class std::allocator<char> >::~zlib_compressor_impl<class std::allocator<char> (void)" (??1?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE@XZ) 1>zlib_test.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::iostreams::detail::zlib_base::do_init(struct boost::iostreams::zlib_params const &,bool,void * (__cdecl*)(void *,unsigned int,unsigned int),void (__cdecl*)(void *,void *),void *)" (?do_init@zlib_base@detail@iostreams@boost@@AAEXABUzlib_params@34@_NP6APAXPAXII@ZP6AX22@Z2@Z) referenced in function "protected: void __thiscall boost::iostreams::detail::zlib_base::init<class std::allocator<char> (struct boost::iostreams::zlib_params const &,bool,struct boost::iostreams::detail::zlib_allocator<class std::allocator<char>,class std::allocator<char> > &)" (??$init@V?$allocator@D@std@@@zlib_base@detail@iostreams@boost@@IAEXABUzlib_params@23@_NAAU?$zlib_allocator@V?$allocator@D@std@@V12@@123@@Z) 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::stream_end" (?stream_end@zlib@iostreams@boost@@3HB) 1>zlib_test.obj : error LNK2019: unresolved external symbol "public: static void __cdecl boost::iostreams::zlib_error::check(int)" (?check@zlib_error@iostreams@boost@@SAXH@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_compressor_impl<class std::allocator<char> >::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z) 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: void __thiscall boost::iostreams::detail::zlib_base::after(char const * &,char * &,bool)" (?after@zlib_base@detail@iostreams@boost@@IAEXAAPBDAAPAD_N@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_compressor_impl<class std::allocator<char> ::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z) 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: int __thiscall boost::iostreams::detail::zlib_base::deflate(int)" (?deflate@zlib_base@detail@iostreams@boost@@IAEHH@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_compressor_impl<class std::allocator<char> ::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z) 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::no_flush" (?no_flush@zlib@iostreams@boost@@3HB) 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::finish" (?finish@zlib@iostreams@boost@@3HB) 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: void __thiscall boost::iostreams::detail::zlib_base::before(char const * &,char const *,char * &,char *)" (?before@zlib_base@detail@iostreams@boost@@IAEXAAPBDPBDAAPADPAD@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_compressor_impl<class std::allocator<char> ::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_compressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z) 1>zlib_test.obj : error LNK2019: unresolved external symbol "protected: int __thiscall boost::iostreams::detail::zlib_base::inflate(int)" (?inflate@zlib_base@detail@iostreams@boost@@IAEHH@Z) referenced in function "public: bool __thiscall boost::iostreams::detail::zlib_decompressor_impl<class std::allocator<char> ::filter(char const * &,char const *,char * &,char *,bool)" (?filter@?$zlib_decompressor_impl@V?$allocator@D@std@@@detail@iostreams@boost@@QAE_NAAPBDPBDAAPADPAD_N@Z) 1>zlib_test.obj : error LNK2001: unresolved external symbol "int const boost::iostreams::zlib::sync_flush" (?sync_flush@zlib@iostreams@boost@@3HB) 1>D:\Debug\libz_compression_test.exe : fatal error LNK1120: 16 unresolved externals 1>Build log was saved at "file://d:\\compression\libz_compression_test\Debug\BuildLog.htm" 1>libz_compression_test - 17 error(s), 0 warning(s)
Steven Watanabe-4 wrote:
AMDG
ChristinaDRS wrote:
I have the following code simple code to compress/uncompress a string: <snip> 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 ==========
<snip>
Any ideas how I can fix this?
Does the file libboost_bzip2-vc90-mt-gd-1_39.lib exist? Have you set the library path in the IDE?
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/need-help-using-boost-bzip2-filter-on-Windows-%28or-zl... Sent from the Boost - Users mailing list archive at Nabble.com.
Hello Christina, On 10/21/2009 10:12 PM, ChristinaDRS wrote:
Hello all,
I have the following code simple code to compress/uncompress a string:
[snip]
1>Linking... 1>LINK : fatal error LNK1104: cannot open file 'libboost_bzip2-vc90-mt-gd-1_39.lib' [snip]
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 was also perplexed by those instructions; The variables are boost.build variables, not environmental variables. Please use bjam .... -sBZIP2_SOURCE=D:\bzip2-1.0.5 -sZLIB_SOURCE=... in order to get libboost_bzip2 and libboost_zlib compiled. Cheers, Mikko
Mikko Vainio wrote:
Hello Christina,
On 10/21/2009 10:12 PM, ChristinaDRS wrote:
Hello all,
I have the following code simple code to compress/uncompress a string:
[snip]
1>Linking... 1>LINK : fatal error LNK1104: cannot open file 'libboost_bzip2-vc90-mt-gd-1_39.lib' [snip]
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 was also perplexed by those instructions; The variables are boost.build variables, not environmental variables. Please use bjam .... -sBZIP2_SOURCE=D:\bzip2-1.0.5 -sZLIB_SOURCE=... in order to get libboost_bzip2 and libboost_zlib compiled.
Actually, environment variables should work fine. It's not clear from the above report whether the variables were defined when building Boost itself, and whether the libboost_bzip2... library was produced. - Volodya
I actually installed Boost with the BoostPro package. Maybe that doesnt allow me to build those libraries? I did not have those environment variables set at the time however. Thanks, Christina Vladimir Prus-3 wrote:
Mikko Vainio wrote:
Hello Christina,
On 10/21/2009 10:12 PM, ChristinaDRS wrote:
Hello all,
I have the following code simple code to compress/uncompress a string:
[snip]
1>Linking... 1>LINK : fatal error LNK1104: cannot open file 'libboost_bzip2-vc90-mt-gd-1_39.lib' [snip]
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 was also perplexed by those instructions; The variables are boost.build variables, not environmental variables. Please use bjam .... -sBZIP2_SOURCE=D:\bzip2-1.0.5 -sZLIB_SOURCE=... in order to get libboost_bzip2 and libboost_zlib compiled.
Actually, environment variables should work fine. It's not clear from the above report whether the variables were defined when building Boost itself, and whether the libboost_bzip2... library was produced.
- Volodya
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/need-help-using-boost-bzip2-filter-on-Windows-%28or-zl... Sent from the Boost - Users mailing list archive at Nabble.com.
ChristinaDRS wrote:
I actually installed Boost with the BoostPro package. Maybe that doesnt allow me to build those libraries? I did not have those environment variables set at the time however.
Is libboost_bzip2-vc90-mt-gd-1_39.lib present in whatever directory you have installed to? If not, then: - BoostPro packages do not include those libs, and - setting any environment variables will not help. You probably need to get sources, and build it. - Volodya
participants (4)
-
ChristinaDRS
-
Mikko Vainio
-
Steven Watanabe
-
Vladimir Prus