我想要编译这样simple code:与如何在Windows上使用zip(gz)支持分离地构建Boost.Iostreams?
#include <iostream>
#include <fstream>
#include <string>
#include <zlib.h>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
int main()
{
std::string hello = "Hello world";
std::ofstream zip_png_file("hello.gz", std::ofstream::binary);
boost::iostreams::filtering_streambuf< boost::iostreams::input> in;
in.push(boost::iostreams::gzip_decompressor());
in.push(hello);
boost::iostreams::copy(in, zip_png_file);
std::cin.get();
return 0;
}
我已经compioled提升:
-j4 --prefix="C:\Program Files\Boost" --without-mpi --without-python link=static runtime-link=static install
到那个时候我已经安装在我的系统中没有zlib的或的bzip2。现在我静态编译的zlib和bzib2为"C:\Program Files\zlib"
和"C:\Program Files\bzip2"
(与艾德里安lib
和include
文件夹)
我创建简单的VS2010项目,静态链接的提振,加挂拉链包含的文件夹。但不是编译我得到了5个错误:
Error 5 error C1903: unable to recover from previous error(s); stopping compilation c:\program files (x86)\boost-1.47.0\include\boost\iostreams\traits.hpp 242
Error 1 error C2039: 'category' : is not a member of 'std::basic_string<_Elem,_Traits,_Ax>' c:\program files (x86)\boost-1.47.0\include\boost\iostreams\traits.hpp
Error 2 error C2146: syntax error : missing ';' before identifier 'type' c:\program files (x86)\boost-1.47.0\include\boost\iostreams\traits.hpp 242
Error 4 error C2208: 'boost::type' : no members defined using this type c:\program files (x86)\boost-1.47.0\include\boost\iostreams\traits.hpp 242
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files (x86)\boost-1.47.0\include\boost\iostreams\traits.hpp 242
所以我想所有boost编译后可以zlib的连接,以提高IOSTREAMS或我必须重建吧],如果是我将添加到我的哪些参数来获得100%静态链接正常Boost + Boost.Iostreams(支持zlib)?