更新时间:2023-09-26 17:06:46
要查找正在使用的库,可以运行
To find which library is being used you could run
$ /sbin/ldconfig -p | grep stdc++
libstdc++.so.6 (libc6) => /usr/lib/libstdc++.so.6
libstdc ++版本3.4.0及更高版本的兼容版本列表由
The list of compatible versions for libstdc++ version 3.4.0 and above is provided by
$ strings /usr/lib/libstdc++.so.6 | grep LIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
...
对于早期版本,符号GLIBCPP
已定义.
For earlier versions the symbol GLIBCPP
is defined.
库的日期戳在宏__GLIBCXX__
或__GLIBCPP__
中定义,具体取决于版本:
The date stamp of the library is defined in a macro __GLIBCXX__
or __GLIBCPP__
depending on the version:
// libdatestamp.cxx
#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;
}
$ g++ libdatestamp.cxx -o libdatestamp
$ ./libdatestamp
GLIBCXX: 20101208