Reputation: 351
I'm trying to 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.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
But get error:
Source.o:Source.cpp:(.text+0x17): undefined reference to `boost::iostreams::zlib::default_compression'
collect2.exe: error: ld returned 1 exit status
So it seems that iostreams wasn't built properly. How can I check whether boost_iostreams-mgw63-mt-x32-1_72 was built fine? Or what's my problem? I used the following command to build iostreams:
D:\boost_1_72_0>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"
Upvotes: 0
Views: 1434
Reputation: 351
Ok, I fixed the problem. Instead _SOURCE I manually specified _INCLUDE and _LIBPATH dirs. 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"
Upvotes: 0