【问题标题】:build boost::iostreams with zlib使用 zlib 构建 boost::iostreams
【发布时间】:2020-07-19 17:16:12
【问题描述】:

我正在尝试构建以下代码:

#include <boost/iostreams/filter/zlib.hpp>
#include <iostream>

int main(int argc, char* argv[])
{
  int a = boost::iostreams::zlib::default_compression;
  std::cout << a;
  return 0;
}

使用命令:

g++ -Wall -ID:\boost_1_72_0 -c -o Source.o Source.cpp
g++ -Wall -ID:\boost_1_72_0 Source.o -LD:\boost_1_72_0\stage\lib -lboost_iostreams-mgw63-mt-x32-1_72 -o Source.exe

但得到错误:

Source.o:Source.cpp:(.text+0x17): undefined reference to `boost::iostreams::zlib::default_compression'
collect2.exe: error: ld returned 1 exit status

所以看来 iostreams 没有正确构建。 如何检查 boost_iostreams-mgw63-mt-x32-1_72 是否构建良好?或者我的问题是什么?我使用以下命令构建 iostream:

D:\boost_1_72_0&gt;b2 -a -q -j8 address-model=32 link=static threading=multi toolset=gcc runtime-link=shared variant=release --with-iostreams -sBZIP2_SOURCE="C:\Program Files (x86)\GnuWin32" -sZLIB_SOURCE="C:\Program Files (x86)\GnuWin32"

【问题讨论】:

    标签: c++ gcc boost gnu boost-iostreams


    【解决方案1】:

    好的,我解决了这个问题。而是 _SOURCE 我手动指定 _INCLUDE _LIBPATH 目录。 b2 -a -q -j8 address-model=32 link=static threading=multi toolset=gcc runtime-link=shared variant=release --with-iostreams -sZLIB_INCLUDE="C:\Program Files (x86)\GnuWin32\include" -sZLIB_LIBPATH="C:\Program Files (x86)\GnuWin32\lib" -sBZIP2_INCLUDE="C:\Program Files (x86)\GnuWin32\include" -sBZIP2_LIBPATH="C:\Program Files (x86)\GnuWin32\lib"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 1970-01-01
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多