1

My code is currently using boost filesystem library. It can be compiled with the command

g++ program.cc -o program -std=c++11 -I /tools/boost/1.64/3/linux64/rel/include/ -L/tools/boost/1.64/3/linux64/rel/lib -lboost_filesystem -lboost_system

However, it fails in the linking stage with errors similar to

/tools/boost/1.64/3/linux64/rel/lib/libboost_filesystem.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_not_of(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'

Any suggestions on why this is happening?

beaverKnight
  • 11
  • 1
  • 2
  • 1
    Did you build boost? If so, with what options? – user4581301 Jul 26 '18 at 21:09
  • Do you mean building from source? No I did not build boost. This is actually a very weird situation: I need to use the boost library that was built on some other people's machine, and I am not sure how they built it. Currently I have the access to all the hpp files and .so/.a files, and I am using -I and -L to specify where these files are. – beaverKnight Jul 26 '18 at 21:36
  • For a quick experiment, make a small program that exercises `string` interaction with the boost library. Make sure it has the linker error when compiled against the C++11 Standard. Then rebuild without C++11 and see if the program links. – user4581301 Jul 26 '18 at 22:07
  • 2
    That's the well known Dual ABI linking bug https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html – Henri Menke Jul 27 '18 at 00:03
  • @HenriMenke yeah, that or similar errors caused by ABI difference. Not a bug at all, hence – sehe Jul 27 '18 at 02:32

0 Answers0