简体   繁体   English

g++: CreateProcess: 没有这样的文件或目录。 找不到解决办法

[英]g++: CreateProcess: No such file or directory. Can't find solution

Edit: whoops.编辑:哎呀。 Forgot to put the correct link while formatting格式化时忘记放正确的链接

I'm following this tutorial, but I have gotten an error I can't fixed (I've looked at my code and then back at his for around 25 minutes. I'm sure it's not a typo anywhere)我正在学习教程,但遇到了一个无法修复的错误(我查看了我的代码,然后又看了他的代码大约 25 分钟。我确定这不是任何地方的错字)

C:\Users\badfitz66\Rastering>make
g++     makefile.cpp   -o makefile
g++: error: CreateProcess: No such file or directory
make: *** [makefile] Error 1

The code of makefile.cpp is: makefile.cpp 的代码是:

OBJ = main.o
INC = -I "./"

Rastering: $(OBJ)
  g++ $(OBJ) -o Rastering.exe
    rm -f $(OBJ)

main.o:
    g++ -c main.cpp $(INC)

clean:
    rm -f $(OBJ) Rastering

When you write -o makefile it means you want your C++ compiler to write its output to a file named makefile .当您编写-o makefile这意味着您希望 C++ 编译器将其输出写入名为makefile Since Windows has case-insensitive file systems, that is a very bad idea because you will end up overwriting your Makefile, which should be named Makefile .由于 Windows 具有不区分大小写的文件系统,这是一个非常糟糕的主意,因为您最终会覆盖应命名为Makefile

Also, you seem very confused about the difference between a Makefile and a C++ file.此外,您似乎对 Makefile 和 C++ 文件之间的区别感到非常困惑。 The file you posted is a Makefile, so it should be named Makefile , not makefile.cpp .你发布的文件是一个 Makefile,所以它应该被命名为Makefile ,而不是makefile.cpp You will need to have at least two files: Makefile , and main.cpp .您至少需要有两个文件: Makefilemain.cpp If you want more help, you will have to show us the full contents of both of those files and the exact output you get when you run make .如果您需要更多帮助,则必须向我们展示这两个文件的完整内容以及运行make时获得的确切输出。

The error g++: error: CreateProcess: No such file or directory is usually caused by your toolchain not being installed properly.错误g++: error: CreateProcess: No such file or directory通常是由于您的工具链没有正确安装造成的。 You will need to install a C++ compiler that provides an executable named g++.exe and make sure that you add the directory with g++.exe in it to your PATH environment variable.您需要安装一个 C++ 编译器,该编译器提供名为g++.exe的可执行文件,并确保将包含g++.exe的目录添加到 PATH 环境变量中。 The tutorial video you linked to ought to tell you how to do that.您链接的教程视频应该告诉您如何做到这一点。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM