|
Boost Users : |
From: Andreas Profous (andreas_at_[hidden])
Date: 2008-03-25 10:44:26
Hi,
I'm trying to compile the following example code on Windows XP using
MS Visual Studio 2005:
-- from http://www.boost.org/libs/iostreams/doc/classes/zlib.html#installation
//////////////////////////////
#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;
using namespace boost::iostreams; // added this line
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);
}
////////////////////////////////
So I downloaded the zlib library into the directory C:\Libs\zlib123
plus a prebuilt windows binary into the directory
C:\Libs\zlib123\dll32
After reading http://www.boost.org/libs/iostreams/doc/installation.html
I tried to add zlib.cpp to my test project,
and to add the line #define BOOST_IOSTREAMS_NO_LIB to my source file.
I got a bunch of linker errors, e.g.
1>zlib.obj : error LNK2019: unresolved external symbol _crc32
referenced in function "protected: void __thiscall
boost::iostreams::detail::zlib_base::after(char const * &,char *
&,bool)" (?after_at_zlib_base_at_detail@iostreams_at_boost@@IAEXAAPBDAAPAD_N_at_Z)
1>C:\Dev\Test\Test\Debug\Test.exe : fatal error LNK1120: 9 unresolved externals.
If I delete ' #define BOOST_IOSTREAMS_NO_LIB' I get the following error:
1>LINK : fatal error LNK1104: cannot open file
'libboost_zlib-vc80-mt-gd-1_34_1.lib'
Which is a file that doesn't exist.
As I understand it I have to rebuild boost.iostreams with zlib support:
C:\boost\boost_1_34_1\libs\iostreams\build>bjam
"-sNO_COMPRESSION=0"
"-sNO_ZLIB=0"
"-sZLIB_SOURCE=C:\Libs\zlib123"
"-sZLIB_LIBPATH=C:\Libs\zlib123\dll32"
"-sZLIB_BINARY=zlibwapi.dll"
I tried this and that but to be honest I don't really know what I'm
doing and it didn't work.
I would like to compile a static library and link my program against
it, so that the example code works.
It would also be ok to link it against a .dll - I don't really care, I
just want to SOMEHOW use it! :)
Can somebody give me detailed instructions on how to do that?
Andreas
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