5
我试图编译例如从升压Gzip已过滤器页面:升压Gzip已过滤器:编译failes
#include <fstream>
#include <iostream>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
int main()
{
using namespace std;
ifstream file("hello.gz", ios_base::in | ios_base::binary);
filtering_streambuf<input> in;
in.push(gzip_decompressor());
in.push(file);
boost::iostreams::copy(in, cout);
}
可悲的是我的G ++会返回错误:
gzlib.cpp: In function ‘int main()’:
gzlib.cpp:12:3: error: ‘filtering_streambuf’ was not declared in this scope
gzlib.cpp:12:23: error: ‘input’ was not declared in this scope
gzlib.cpp:12:30: error: ‘in’ was not declared in this scope
gzlib.cpp:13:29: error: ‘gzip_decompressor’ was not declared in this scope
有什么不对的功能,以及如何修改它使其工作?非常感谢!
链接,以提高Gzip已过滤器:http://www.boost.org/doc/libs/release/libs/iostreams/doc/classes/gzip.html
有很多错误,所以我把输出到pastebin。可能是我的Boost工作不正确? http://pastebin.com/fG2ZqpaJ – ghostmansd
@ghostmansd:如[此处](http://www.boost.org/doc/libs/release/libs/iostreams/doc/classes/gzip.html#installation)所述,你需要链接到'zlib'才能工作。 'zlib'是'boost'外部的,但通常预装在UNIX系统上,否则可以从[here](http://zlib.net/)下载。 – Mankarse
我使用-lz编译,但它没有帮助。 – ghostmansd