Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

Can't link static boost::iostreams library

$
0
0

I build the following code:

#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;}

With the command:

g++ -Wall -ID:\boost_1_72_0 -c -o Source.o Source.cppg++ -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

And it works, but only if boost_iostreams-mgw63-mt-x32-1_72 is shared library. If I try to use static library it'll give me the following error: D:\boost_1_72_0\stage\lib/libboost_iostreams-mgw63-mt-x32-1_72.a(zlib.o):zlib.cpp:(.text+0x124): undefined reference to crc32'

I build static library with the following command: 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"

If I change link=staic to link=shared and then copy dll to the project's folder - everything will be ok. But I want program to work w/o dlls.

What's the problem? How do I run and build the program w/o shared libs?


Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>