[cfe-dev] Linker error with boost::iostreams

Leszek Świrski ls426 at cam.ac.uk
Sat Dec 11 03:00:27 PST 2010


Hello,

I get a linker error after trying to compile with clang++ a program using 
boost::iostreams. I've reduced the issue to a minimal case, as detailed 
below:

$ cat test.cpp 
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/file.hpp>

int main(void)
{
    namespace io = boost::iostreams;
    io::stream<io::file> test("");
}

$ g++ test.cpp && echo Success 
Success

$ clang++ test.cpp /tmp/cc-fe0zit.o: In function `std::fpos<__mbstate_t> 
boost::iostreams::detail::seek_device_impl<boost::iostreams::streambuf_tag>::seek<std::basic_filebuf<char, 
std::char_traits<char> > >(std::basic_filebuf<char, std::char_traits<char> 
>&, long long, std::_Ios_Seekdir, std::_Ios_Openmode)': 
test.cpp:(.gnu.linkonce.t._ZN5boost9iostreams6detail16seek_device_implINS0_13streambuf_tagEE4seekISt13basic_filebufIcSt11char_traitsIcEEEESt4fposI11__mbstate_tERT_xSt12_Ios_SeekdirSt13_Ios_Openmode+0x138): 
undefined reference to `std::basic_streambuf<char, std::char_traits<char> 
>::pubseekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)' 
/tmp/cc-fe0zit.o:(.gnu.linkonce.r._ZTVN5boost9iostreams6detail16linked_streambufIcSt11char_traitsIcEEE+0x18): 
undefined reference to `std::basic_streambuf<char, std::char_traits<char> 
>::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)' clang: error: 
linker command failed with exit code 1 (use -v to see invocation)

$ clang++ --version
clang version 2.9 (trunk 121486)
Target: i386-pc-linux-gnu
Thread model: posix


Thanks,

- Leszek



More information about the cfe-dev mailing list