How do I check my gcc C++ compiler version for my Eclipse? How do I check my gcc C++ compiler version for my Eclipse? linux linux

How do I check my gcc C++ compiler version for my Eclipse?


Just type

gcc --version

in any terminal near you.. ;-)


gcc -dumpversion

-dumpversion Print the compiler version (for example, 3.0) — and don't do anything else.

The same works for following compilers/aliases:

cc -dumpversiong++ -dumpversionclang -dumpversiontcc -dumpversion

Be careful with automate parsing the GCC output:

  • Output of --version might be localized (e.g. to Russian, Chinese, etc.)
  • GCC might be built with option --with-gcc-major-version-only. And some distros (e.g. Fedora) are already using that
  • GCC might be built with option --with-pkgversion. And --version output will contain something like Android (5220042 based on r346389c) clang version 8.0.7 (it's real version string)


#include <stdio.h>int main() {  printf("gcc version: %d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);  return 0;}