Home >Backend Development >C++ >Here are a few article titles, generated from your text, that fit the query: * How to Determine the Installed libstdc Library Version on Linux * Beyond \'strings\': Precise Methods for Fi

Here are a few article titles, generated from your text, that fit the query: * How to Determine the Installed libstdc Library Version on Linux * Beyond \'strings\': Precise Methods for Fi

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-28 08:47:02423browse

Here are a few article titles, generated from your text, that fit the query:

* How to Determine the Installed libstdc   Library Version on Linux
* Beyond

Querying the Installed libstdc Library Version on Linux

One common method for viewing the installed libstdc library version involves extracting the relevant data from the library file itself using a command like strings /usr/lib/libstdc .so.6 | grep GLIBC. While this approach may yield results, it is considered an ad-hoc or heuristic method.

Fortunately, there are more precise commands available for obtaining this information. One such command is:

$ /sbin/ldconfig -p | grep stdc++

This command lists the compatible libraries for libstdc and their corresponding locations.

For versions 3.4.0 and above, a more specific approach is to use the following command:

$ strings /usr/lib/libstdc++.so.6 | grep LIBCXX

This command displays the list of compatible versions for the specified libstdc version.

Alternatively, the date stamp of the library can be obtained using the following code:

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

int main() {
#ifdef __GLIBCPP__
    printf("GLIBCPP: %d\n", __GLIBCPP__);
#endif
#ifdef __GLIBCXX__
    printf("GLIBCXX: %d\n", __GLIBCXX__);
#endif
    return 0;
}</code>

After compiling the code, running the executable provides the date stamp for the installed libstdc version.

For reference, the table of datestamps for various libstdc versions can be found in the official documentation.

The above is the detailed content of Here are a few article titles, generated from your text, that fit the query: * How to Determine the Installed libstdc Library Version on Linux * Beyond \'strings\': Precise Methods for Fi. 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