MinGW 错误:不存在这样的文件或目录

MinGW error: No such file or directory exists(MinGW 错误:不存在这样的文件或目录)

本文介绍了MinGW 错误:不存在这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这是我在 MinGW 中输入的内容

This is what I typed into MinGW

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

之后出现错误.

我也确实将环境设置路径更改为 C:MinGWin

Also I did change the Environment Settings path to C:MinGWin

推荐答案

要使其工作,您应该从程序所在的文件夹运行编译器,而不是 MinGW 所在的文件夹.首先,您需要设置 PATH 以包含 MinGW.您可以使用 set PATH = C:MinGWin;%PATH% 在命令行上执行此操作.

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:MinGWin;%PATH% on the command line.

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

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

希望这有帮助!

这篇关于MinGW 错误:不存在这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:MinGW 错误:不存在这样的文件或目录

基础教程推荐