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

LinuxEclipseFedora

Linux Problem Overview


I'm using Eclipse release version 3.7.0, but I can't find the gcc anywhere. How and where can I see the version of gcc I'm currently using?

Linux Solutions


Solution 1 - Linux

Just type

gcc --version

in any terminal near you.. ;-)

Solution 2 - Linux

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 -dumpversion
g++ -dumpversion
clang -dumpversion
tcc -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)

Solution 3 - Linux

#include <stdio.h>

int main() {

  printf("gcc version: %d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
  return 0;
}

Solution 4 - Linux

The answer is:

gcc --version

Rather than searching on forums, for any possible option you can always type:

gcc --help

haha! :)

Solution 5 - Linux

you can also use gcc -v command that works like gcc --version and if you would like to now where gcc is you can use whereis gcc command

I hope it'll be usefull

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1157977View Question on Stackoverflow
Solution 1 - LinuxfuesikaView Answer on Stackoverflow
Solution 2 - LinuxsergheiView Answer on Stackoverflow
Solution 3 - LinuxWahidView Answer on Stackoverflow
Solution 4 - LinuxAmitesh RanjanView Answer on Stackoverflow
Solution 5 - LinuxmoshtaghView Answer on Stackoverflow