0

I have been having an issue with my boost C++ library. My code compiles but when I get to the linker stage, the IDE fails to link and gives me this error:

/usr/local/include/boost/archive/detail/oserializer.hpp:90: undefined reference to `boost::archive::text_oarchive_impl::save(std::string const&)'

There are some other errors underneath this one related to the Boost library. I believe that all of these errors are related to each other.

I am not sure what the cause could be? My code compiles so I know that the compiler is referencing the Boost library correctly. Here is the full linker command:

/usr/bin/g++-4.9 -o ./Debug/Omni-FEM @"Omni-FEM.txt" -L. -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -L/usr/lib/lapack  -lfreetype -lGLEW -llapack -lboost_iostreams -lboost_serialization  -lglut -lGL -lGLU -L/usr/local/lib -pthread   -lwx_gtk2u_xrc-3.1 -lwx_gtk2u_stc-3.1 -lwx_gtk2u_richtext-3.1 -lwx_gtk2u_ribbon-3.1 -lwx_gtk2u_propgrid-3.1 -lwx_gtk2u_aui-3.1 -lwx_gtk2u_gl-3.1 -lwx_gtk2u_html-3.1 -lwx_gtk2u_qa-3.1 -lwx_gtk2u_adv-3.1 -lwx_gtk2u_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1   /usr/local/lib/libboost_serialization.a /usr/local/lib/libboost_wserialization.a

I know that I am referencing the libraries correctly with wserialization and serialization. I also added a bit in there to link directly to the libraries and I am still getting the same issue.

I compiled the boost library 1.64 into /usr/local folder.

Am I missing some linker options? Has anyone else ran into an issue such as this?

codingDude
  • 331
  • 1
  • 2
  • 10
  • Post some [mcve](https://stackoverflow.com/help/mcve). You probably use the serializer incorrectly, because templated `save` function should be instantiated with appropriate `Archive` by `boost`. Your linker options seem to be correct (superfluous, though). – pptaszni Oct 19 '18 at 14:32
  • Your command invokes explicitly `g++-4.9`. Do you have default g++ version 5 or above? There was ABI change between 4 and 5. If so, make sure you compile boost with 4.9 as well. Also, having both `-lboost_serialization` and `/usr/local/lib/libboost_serialization.a` looks strange - the first one probably should be removed. – dewaffled Oct 19 '18 at 14:35

0 Answers0