Check glibc version for a particular gcc compiler

后端 未结 8 1207
既然无缘
既然无缘 2020-11-29 19:13

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

8条回答
  •  时光取名叫无心
    2020-11-29 19:31

    Write a test program (name it for example glibc-version.c):

    #include 
    #include 
    #include 
    
    int main(int argc, char *argv[]) {
      printf("GNU libc version: %s\n", gnu_get_libc_version());
      exit(EXIT_SUCCESS);
    }
    

    and compile it with the gcc-4.4 compiler:

    gcc-4.4 glibc-version.c -o glibc-version
    

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

提交回复
热议问题