检查特定 gcc 编译器的 glibc 版本 [英] Check glibc version for a particular gcc compiler
本文介绍了检查特定 gcc 编译器的 glibc 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的系统上安装了两个 gcc 编译器,一个是 gcc 4.1.2
(默认),另一个是 gcc 4.4.4
.我如何检查 gcc 4.4.4
使用的 libc 版本,因为 /lib/libc.so.6
显示了 gcc 4.1.2<使用的 glibc/code>,因为它是默认编译器.
I have two gcc compilers installed on my system, one is gcc 4.1.2
(default) and the other is gcc 4.4.4
. How can I check the libc version used by gcc 4.4.4
, because /lib/libc.so.6
shows the glibc used by gcc 4.1.2
, since it is the default compiler.
推荐答案
编写一个测试程序(以glibc-version.c
为例):
Write a test program (name it for example glibc-version.c
):
#include <stdio.h>
#include <stdlib.h>
#include <gnu/libc-version.h>
int main(int argc, char *argv[]) {
printf("GNU libc version: %s
", gnu_get_libc_version());
exit(EXIT_SUCCESS);
}
并使用 gcc-4.4 编译器编译它:
and compile it with the gcc-4.4 compiler:
gcc-4.4 glibc-version.c -o glibc-version
当您执行 ./glibc-version
时,会显示使用的 glibc 版本.
When you execute ./glibc-version
the used glibc version is shown.
这篇关于检查特定 gcc 编译器的 glibc 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文