Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Undefined reference to boost symbol

📅 2014-Jul-07 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ boost, error ⬩ 📚 Archive

Problem

I was compiling code from someone using a Makefile. It gave this error:

/usr/bin/ld: main.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'

Solution

If you demangle the C++ symbol _ZN5boost6system15system_categoryEv using C++Filt you get the function boost::system::system_category(). So, the code was using this function, but was missing the library file. Adding the linker directive -lboost_system to include the library, fixed the error.

Tried with: Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧