MinGW错误:没有此类文件或目录存在

编程入门 行业动态 更新时间:2024-10-25 07:21:17
本文介绍了MinGW错误:没有此类文件或目录存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Windows XP SP3上运行MinGW。我在C ++中编写了一个简单的程序并将其保存为.cpp文件。当我试图在MinGW中在正确的目录下编译它时,出现一条消息:错误:没有这样的文件或目录存在,但我知道它在正确的目录中。

这是我输入到MinGW

cd C:\MinGW test#在哪里保存.cpp文件 g ++ test.cpp -o test.exe

p>

此外,我已将环境设置路径更改为C:\MinGW\bin

解决方案

要使它工作,你应该从程序所在的文件夹运行编译器,而不是MinGW。首先,你需要设置你的PATH包括MinGW。您可以在命令行中使用 set PATH = C:\MinGW\bin;%PATH%来执行此操作。

然后, cd 到程序所在的位置并运行 g ++ test.cpp -o test.exe 编译, test 运行。

希望这有助于!

I'm running MinGW on windows XP SP3. I wrote a simple program in C++ and saved it as a .cpp file. When I tried to compile it in MinGW at the correct directory a message appeared saying " Error: No such file or directory exists" but I know its in the correct directory.

This is what I typed into MinGW

cd C:\MinGW test # Where I saved the .cpp file g++ test.cpp -o test.exe

After that an error appears.

Also I did change the Environment Settings path to C:\MinGW\bin

解决方案

To get it to work, you should run the compiler from the folder where the program is, not where MinGW is. First, you need to set your PATH to include MinGW. You can do this with set PATH = C:\MinGW\bin;%PATH% on the command line.

Then, cd to where the program is located and run g++ test.cpp -o test.exe to compile, and test to run.

Hope this helps!

更多推荐

MinGW错误:没有此类文件或目录存在

本文发布于:2023-07-04 11:10:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1023611.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:此类   错误   文件   目录   MinGW

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!