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?
Asked
Active
Viewed 2e+01k times
5 Answers
121
Just type
gcc --version
in any terminal near you.. ;-)

fuesika
- 3,280
- 6
- 26
- 34
-
thanks for your ans. so the gcc comes with the OS itself and not the Eclipse program? as in the gcc version will depends on the OS version? – user1157977 Dec 05 '13 at 01:05
-
Yes, Eclipse is just a glorified editor. The compiler is the command-line driven `gcc` (or it could be the `clang` command); there probably is a way to configure Eclipse to tell it which compiler should it use (or to tell it to use the `make` builder to compile programs). You can have installed several versions of `gcc` ... – Basile Starynkevitch Dec 05 '13 at 05:35
29
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 likeAndroid (5220042 based on r346389c) clang version 8.0.7
(it's real version string)

serghei
- 3,069
- 2
- 30
- 48
-
1Thank you. It's what exactly I need. I need to get version of gcc at my script, so don't wanna parse output of `gcc --version` which contains bunch of information. – anton_rh Apr 23 '17 at 18:16
-
2
15
#include <stdio.h>
int main() {
printf("gcc version: %d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
return 0;
}

Wahid
- 149
- 1
- 6
-
this answers the question **How and where can I see the version of gcc I'm currently using?** simply running this code we can find the **gcc version** – Wahid Nov 21 '16 at 15:49
-
1
-
3I know this doesn't answer the question but I was looking for this, so thanks :) – Jespertheend Dec 17 '16 at 18:33
9
The answer is:
gcc --version
Rather than searching on forums, for any possible option you can always type:
gcc --help
haha! :)

Amitesh Ranjan
- 1,162
- 1
- 12
- 9
3
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

moshtagh
- 221
- 2
- 2