Home >Backend Development >C++ >Why am I getting an 'undefined reference to 'boost::system::system_category()'' error during compilation?
Undefined Reference to 'boost::system::system_category()' during Compilation
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()
Explanation:
This error arises when a program relies on the boost::system library, which is not explicitly linked during compilation.
Resolution:
To rectify this issue, you need to link your program against the boost_system library. If you're using gcc, append the following flag to your compiler command:
-lboost_system
This flag instructs the linker to include the boost_system library when compiling your program, resolving the undefined reference.
The above is the detailed content of Why am I getting an 'undefined reference to 'boost::system::system_category()'' error during compilation?. For more information, please follow other related articles on the PHP Chinese website!