minGW:“没有规则可以制定目标”
我意识到之前已经有人问过此类问题,但是我到处寻找,但找不到解决方案。
我试图使用 minGW 的 make 实用程序调用 makefile,但是我不断遇到此错误:
D:\Aufgabe 4>mingw32-make -f aufgabe4.make mingw32-make:*没有规则可以生成目标
half_adder.o,',由
aufgabe4.out'需要。停止。”
这是 makefile 的内容:
aufgabe4.out : half_adder.o, adder.o, program.o
g++ -o aufgabe4.out half_adder.o adder.o program.o
half_adder.o: half_adder.h half_adder.cpp
g++ -c half_adder.cpp
adder.o: half_adder.h half_adder.cpp adder.h adder.cpp
g++ -c adder.cpp
program.o: half_adder.h adder.h program.cpp
g++ -c program.cpp
clean:
rm *.o aufgabe4.out
这是目录的内容:
D:\Aufgabe 4>dir
Volume in drive D has no label.
Volume Serial Number is 6E0B-16A3
Directory of D:\Aufgabe 4
11/08/2011 12:29 PM <DIR> .
11/08/2011 12:29 PM <DIR> ..
11/08/2011 12:02 PM 381 adder.cpp
11/08/2011 11:52 AM 88 adder.h
11/08/2011 01:01 PM 346 aufgabe4.make
11/08/2011 11:56 AM 171 half_adder.cpp
11/08/2011 11:54 AM 78 half_adder.h
11/08/2011 12:15 PM 421 program.cpp
6 File(s) 1,485 bytes
2 Dir(s) 2,241,265,664 bytes free
我将不胜感激任何帮助或建议。
谢谢。
I realize this type of question has been asked earlier, however I looked everywhere and I couldn't find a solution.
I am trying to invoke a makefile using minGW's make utility, however I keep running into this error:
D:\Aufgabe 4>mingw32-make -f
aufgabe4.make
mingw32-make: * No rule to make targethalf_adder.o,', needed by
aufgabe4.out'. Stop.'
This is the content of the makefile:
aufgabe4.out : half_adder.o, adder.o, program.o
g++ -o aufgabe4.out half_adder.o adder.o program.o
half_adder.o: half_adder.h half_adder.cpp
g++ -c half_adder.cpp
adder.o: half_adder.h half_adder.cpp adder.h adder.cpp
g++ -c adder.cpp
program.o: half_adder.h adder.h program.cpp
g++ -c program.cpp
clean:
rm *.o aufgabe4.out
This is the content of the directory:
D:\Aufgabe 4>dir
Volume in drive D has no label.
Volume Serial Number is 6E0B-16A3
Directory of D:\Aufgabe 4
11/08/2011 12:29 PM <DIR> .
11/08/2011 12:29 PM <DIR> ..
11/08/2011 12:02 PM 381 adder.cpp
11/08/2011 11:52 AM 88 adder.h
11/08/2011 01:01 PM 346 aufgabe4.make
11/08/2011 11:56 AM 171 half_adder.cpp
11/08/2011 11:54 AM 78 half_adder.h
11/08/2011 12:15 PM 421 program.cpp
6 File(s) 1,485 bytes
2 Dir(s) 2,241,265,664 bytes free
I would appreciate any help or suggestion.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
删除逗号。
Remove the commas.
从 makefile 的第一行中删除“,”。
Remove "," from the first makefile line.
你的 Makefile 的第一行写得不好。修改为:
不能使用逗号分隔目标。仅使用空格。
The first line of your Makefile is badly written. Modify it to this:
You can't use comma to separate the targets. Use spaces only.
您的 make 可能是 GNU make,您可以使用
make --debug 对其进行调试=b
Your make is probably a GNU make, you might debug it using
make --debug=b