问题描述
我在 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 错误:不存在这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)