简体   繁体   English

在 Windows 中编译简单的 C 程序文件时出错 10 CMD 提示使用 MinGW(gcc:错误:没有这样的文件或目录)

[英]Error When Compiling a Simple C Program File in Windows 10 CMD Prompt Using MinGW (gcc: error: No such file or directory)

As the title of the post says, I'm getting an error when trying to compile a simple Hello World C program.正如帖子的标题所说,我在尝试编译一个简单的 Hello World C 程序时遇到错误。 I am on Windows 10, and I believe I have properly installed MinGW onto my PC (and I made sure to add all the extra gcc compilers in the MinGW Installation Manager).我在 Windows 10 上,我相信我已经在我的 PC 上正确安装了 MinGW(并且我确保在 MinGW 安装管理器中添加所有额外的 gcc 编译器)。

Some basic info: I am on Windows 10, I am using MinGW64, I am in the correct directory as my Hello.c file, I am using the correct case (literally copied and pasted), I have tried using the full file location on both the C file and executable (although that shouldn't matter as far as I know), I have changed the PATH of my environmental variables (both user and system) to include C:\MinGW\bin (wouldn't even get this far without this), and I made sure that the file is a C Source Code file from its properties (wrote it from the Visual Studios Text Editor).一些基本信息:我在 Windows 10 上,我正在使用 MinGW64,我在正确的目录中作为我的 Hello.c 文件,我使用正确的大小写(字面上复制和粘贴),我尝试使用完整的文件位置C 文件和可执行文件(尽管据我所知这并不重要),我已经更改了我的环境变量(用户和系统)的 PATH 以包括C:\MinGW\bin (甚至不会得到这个远没有这个),并且我确保该文件是来自其属性的 C 源代码文件(从 Visual Studios 文本编辑器编写)。

I for the life of me cannot figure what I'm doing wrong.我一生都无法弄清楚我做错了什么。 It says it can't find the file when it's right there它说它在那里时找不到文件

(这是我正在处理的截图)

I even tried adding in C:\MinGW\libexec\gcc\mingw32\9.2.0 (got the 9.2.0 from gcc -v ) in the PATH info, but that did nothing.我什至尝试在 PATH 信息中添加C:\MinGW\libexec\gcc\mingw32\9.2.0 (从gcc -v获得 9.2.0 ),但这没有任何作用。

Appreciate any and all suggestions!感谢任何和所有建议!

You should not be working under a system folder C:\Windows\System32 .您不应该在系统文件夹C:\Windows\System32下工作。 Probably there are access restrictions (eg from antivirus) that cause you to run into problems.可能存在导致您遇到问题的访问限制(例如来自防病毒软件)。

I also recommend you don't do it in a path containing spaces or special characters.我还建议您不要在包含空格或特殊字符的路径中执行此操作。

Try under a folder C:\Temp for example.例如,在文件夹C:\Temp下尝试。

If you want to try with a more recent MinGW-w64 you can get it from https://winlibs.com/ .如果您想尝试使用更新的 MinGW-w64,您可以从https://winlibs.com/获得它。 That site also gives an example on how to use it from the Command Prompt.该站点还提供了有关如何从命令提示符中使用它的示例。

If you're new to all this you may also want to consider an IDE like Code::Blocks or Visual Studio Code.如果您不熟悉这一切,您可能还需要考虑 IDE,例如 Code::Blocks 或 Visual Studio Code。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 致命错误:iostream:使用 GCC 编译 C 程序时没有此类文件或目录 - Fatal error: iostream: No such file or directory in compiling C program using GCC 编译C程序时,出现此错误:您好:没有这样的文件或目录 - When compiling a C program, i get this error: hello: no such file or directory 编译C程序后没有这样的文件或目录错误 - No such file or directory error after compiling C program 使用JNI编译简单基本程序的dll时出现gcc错误 - gcc error when compiling the dll for a simple basic program using JNI 使用 MinGW GCC 更改 Windows CMD 上的代码页时,将 _POSIX_C_SOURCE 定义为 2 会导致错误 - Defining _POSIX_C_SOURCE as 2 causes error when changing code page on Windows CMD with MinGW GCC 在 Windows 上使用 MinGW 在 cmd 中编译 C++ 8 - Compiling C++ in cmd using MinGW on Windows 8 MinGW GCC 致命错误 - gcc:CreateProcess:没有这样的文件或目录 - MinGW GCC Fatal Error - gcc: CreateProcess: No such file or directory MingW编译简单的C程序时出现意外的语法错误 - Unexpected syntax error from MingW compiling a simple C program 使用gcc编译c程序时发生冲突类型错误 - conflicting types error when compiling c program using gcc 如何在Windows上使用C语言将AppPath发送到可执行文件的目录(使用MinGW gcc) - How to get AppPath to Executable file's directory using C language on Windows (using MinGW gcc )
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM