Home >Backend Development >C++ >Why am I getting an 'undefined reference to 'boost::system::system_category()'' error during compilation?

Why am I getting an 'undefined reference to 'boost::system::system_category()'' error during compilation?

Susan Sarandon
Susan SarandonOriginal
2024-11-10 19:55:031017browse

Why am I getting an

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn