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