Home >Backend Development >C++ >Why Am I Getting 'undefined reference to boost::system::system_category()' When Compiling?
Error: undefined reference to boost::system::system_category() When Compiling
While attempting to compile a program that utilizes Boost libraries on Ubuntu 11.10, you may encounter the following error:
undefined reference to boost::system::system_category()
Root Cause:
The error stems from the dependency of the specific library being used on the boost_system library, which is not automatically included in the compilation process.
Solution:
To address this issue, you need to explicitly specify the boost_system library in the compilation command line. Assuming you're using gcc, modify the command line to add the -lboost_system flag. This instructs the compiler to link against the boost_system library, making the necessary dependencies available.
Example:
gcc -lboost_system ... <other compiler flags> ...
By incorporating this change, you ensure that the compiler has access to the required symbols from the boost_system library, resolving the linking error and allowing for successful compilation.
The above is the detailed content of Why Am I Getting 'undefined reference to boost::system::system_category()' When Compiling?. For more information, please follow other related articles on the PHP Chinese website!