为什么GCC会抛出关于未指定选项的错误?

时间:2022-09-08 02:30:41

When I run the following command from a makefile on 64-bit Red Hat Enterprise Linux 5.0 using GCC 4.2.3:

当我在64位Red Hat Enterprise Linux 5.0上使用GCC 4.2.3从makefile中运行以下命令时:

gcc -c -ansi -pedantic -O0 -fPIC -I. -I.. -Iheader_files/include "source_file.c"

I get the following error:

我得到以下错误:

cc1: error: unrecognized command line option "-lang-c"

Superficially, the problem is that "-lang-c" is no longer a valid option on newer versions of GCC. However, the deeper question is: Why does GCC receive a "-lang-c" option that wasn't in the original command?

从表面上看,问题是“-lang-c”不再是最新版本的GCC的有效选项。然而,更深层的问题是:为什么GCC会收到一个“-lang-c”选项,而不是原始命令?

Additional background:

额外的背景:

  • The current installation doesn't have any GCC "specs" files that I can find
  • 目前的安装没有任何我能找到的GCC“spec”文件
  • Running "gcc -dumpspecs" produces a long list of defaults, but "-lang-c" isn't among them.
  • 运行“gcc -dumpspec”会产生一长串的默认值,但是“-lang-c”不在其中。
  • "-lang-c" does not appear to be in any environment variables that I know of that influence GCC.
  • “-lang-c”并没有出现在我所知道的任何影响GCC的环境变量中。

Any help would be appreciated.

如有任何帮助,我们将不胜感激。

Regards,

问候,

Mark Biesiada

马克Biesiada

1 个解决方案

#1


2  

Make sure that your gcc driver program is the same version as your installed GCC.

请确保您的gcc驱动程序与安装的gcc相同。

Add the -v option to your compile command to check the versions and where the options are coming from.

将-v选项添加到编译命令中,以检查版本和选项来自何处。

#1


2  

Make sure that your gcc driver program is the same version as your installed GCC.

请确保您的gcc驱动程序与安装的gcc相同。

Add the -v option to your compile command to check the versions and where the options are coming from.

将-v选项添加到编译命令中,以检查版本和选项来自何处。