Linux 我如何检查我的 Eclipse 的 gcc C++ 编译器版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20389193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:32:57  来源:igfitidea点击:

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

linuxeclipsefedora

提问by user1157977

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?

我使用的是 Eclipse 发行版 3.7.0,但我在任何地方都找不到 gcc。如何以及在哪里可以看到我当前使用的 gcc 版本?

采纳答案by fuesika

Just type

只需输入

gcc --version

in any terminal near you.. ;-)

在您附近的任何终端.. ;-)

回答by Amitesh Ranjan

The answer is:

答案是:

gcc --version

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

您可以随时输入任何可能的选项,而不是在论坛上搜索:

gcc --help

haha! :)

哈哈!:)

回答by moshtagh

you can also use gcc -vcommand that works like gcc --versionand if you would like to now where gccis you can use whereis gcccommand

您还可以使用gcc -v类似的命令,gcc --version如果您想现在在哪里 gcc可以使用whereis gcc命令

I hope it'll be usefull

我希望它会很有用

回答by Wahid

#include <stdio.h>

int main() {

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

回答by serghei

gcc -dumpversion

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

-dumpversion打印编译器版本(例如,3.0)——不要做任何其他事情。

The same works for following compilers/aliases:

这同样适用于以下编译器/别名:

cc -dumpversion
g++ -dumpversion
clang -dumpversion
tcc -dumpversion