编译 C 代码时,终端恰好两次显示相同的错误

Terminal is showing the same error exactly twice when compiling the C code

我今天开始在我的 windows 操作系统中进行 C 编程,并完全按照 Visual Studio 代码网站(说明 - https://code.visualstudio.com/docs/cpp/config-mingw)中的描述下载并安装了 GCC 编译器。另外,我已经正确设置了环境变量。一切都 运行 顺利。作为说明,我使用 MSYS2 安装了 GCC 编译器。正在使用mingw64

OS - Windows 10
使用 - Mingw64 版本

所以我自愿犯了一个错误来检查我的代码,并且错误在终端中打印了两次,这非常令人不安。编译并得到我正在使用的错误

gcc -Wall -ansi -pedantic -Werror testing.c -o out

我想摆脱针对同一问题一次出现两个错误而只出现一个错误的情况。协助将不胜感激。

#include<stdio.h>

int main(void)
{
    int s = 76;

    printf("%f", s);

    return 0;
}

如上代码所示

Acer Aspire 5@LAPTOP-IDII92M3 MINGW64 ~/Desktop/New folder
$ gcc -Wall -ansi -pedantic -Werror testing.c -o out

testing.c: In function 'main':

testing.c:7:14: error: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Werror=format=]

    7 |     printf("%f", s);
      |             ~^   ~
      |              |   |
      |              |   int
      |              double
      |             %d
testing.c:7:14: error: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Werror=format=]

    7 |     printf("%f", s);
      |             ~^   ~
      |              |   |
      |              |   int
      |              double
      |             %d
cc1.exe: all warnings being treated as errors

如上所示,我两次收到完全相同的错误消息。我可以根据要求发送图片。

在一个注释中,我在 Linux 虚拟机中尝试了同样的错误。但是,编译器在 Linux 方面不一样,对吗?所以,在 Linux 系统中,我没有得到两次错误。我只得到一次错误,这是得到错误的正确方法。

我自己找到了解决这个问题的方法。如果我们能正确地做事,编译器版本“有时”并不重要。我为 Linux (WSI) 安装了 Windows 子系统,并从 Unix 终端安装了 GCC 编译器。现在我可以像以前使用 Linux 时一样在 VS 代码(我的常用编程 space)中顺利使用该终端。对于可能觉得这有用的任何人,我将添加安装说明站点 here

我能够摆脱我遇到的上述问题,并且我正在顺利地使用 Windows 进行 C 编程。