Skip to content

C Compiler History

C Compiler

GCC version

The History of GCC

C89/C90 -> C95 -> C99 -> C11 -> C17/C18 -> C2x

Use __GNU_LIBRARY__, __GLIBC__ and __GLIBC_MINOR__ to grab GCC version.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// https://ubuntuqa.com/zh-tw/article/10432.html

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{

#ifdef __STDC_VERSION__
  printf("__STDC_VERSION__ = %ld \n", __STDC_VERSION__);
#endif
#ifdef __STRICT_ANSI__
  puts("__STRICT_ANSI__");
#endif

  return 0;
}

Result:

CLang version

~~ TBD ~~

C Library

Glibc version

Use __GNU_LIBRARY__, __GLIBC__ and __GLIBC_MINOR__ to grab C library version.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
// https://unix.stackexchange.com/questions/120380/what-c-library-version-does-my-system-use

#include <gnu/libc-version.h>
#include <stdio.h>

int main(int argc, char *argv[])
{

  printf("%s %s\n", gnu_get_libc_version(), gnu_get_libc_release());
  printf("glibc v%i %i.%i\n", __GNU_LIBRARY__, __GLIBC__, __GLIBC_MINOR__);

  return 0;
}

Result:

Uclibc version

~~ TBD ~~

Musl version

~~ TBD ~~