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
Release: 2024-11-10 19:55:03
Original
1018 people have browsed it

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()
Copy after login

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
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template