Home > Backend Development > C++ > body text

How to Determine the Installed Libstdc Library Version on Linux?

Susan Sarandon
Release: 2024-10-27 12:03:02
Original
260 people have browsed it

How to Determine the Installed Libstdc   Library Version on Linux?

Determining the Installed Libstdc Library Version on Linux

To retrieve the specific version of the libstdc library installed on a Linux system, the following approaches can be employed:

Using System Commands:

One method involves executing the following command:

/sbin/ldconfig -p | grep stdc++
Copy after login

This command will display a list of compatible versions for the installed libstdc library.

Extracting Version Information from the Library:

Alternatively, the version details can be extracted directly from the library file using the following command:

strings /usr/lib/libstdc++.so.6 | grep LIBCXX
Copy after login

This command will output a list of compatible versions for libstdc version 3.4.0 and above. For earlier versions, the symbol GLIBCPP is used instead.

Inspecting Macro Date Stamps:

Another method involves inspecting the macro date stamps defined within the library. The following code snippet can be compiled and executed to retrieve the date stamp:

<code class="cpp">#include <cstdio>

int main(int argc, char* argv[])
{
#ifdef __GLIBCPP__
    std::printf("GLIBCPP: %d\n", __GLIBCPP__);
#endif

#ifdef __GLIBCXX__
    std::printf("GLIBCXX: %d\n", __GLIBCXX__);
#endif

    return 0;
}</code>
Copy after login

The date stamp corresponds to the library version and can be compared against the table provided in the libstdc documentation.

By utilizing any of these approaches, you can accurately determine the version of the libstdc library installed on your Linux machine.

The above is the detailed content of How to Determine the Installed Libstdc Library Version on Linux?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!