MinGW错误:没有此类文件或目录存在 [英] MinGW error: No such file or directory exists

查看:222
本文介绍了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错误:没有此类文件或目录存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆