检查glibc的版本为特定的gcc编译器 [英] Check glibc version for a particular gcc compiler

查看:1062
本文介绍了检查glibc的版本为特定的gcc编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的系统上安装了两个GCC编译器,一个是 GCC 4.1.2 (默认值),另一种是 GCC 4.4.4 。如何检查所使用的版本的libc GCC 4.4.4 ,因为 /lib/libc.so.6 节目使用 GCC 4.1.2 glibc的,因为它是默认的编译器。

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\n", 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的版本所使用的glibc的版本显示。

When you execute ./glibc-version the used glibc version is shown.

这篇关于检查glibc的版本为特定的gcc编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆