minGW:“没有规则可以制定目标”

发布于 2024-12-14 07:04:06 字数 1345 浏览 0 评论 0原文

我意识到之前已经有人问过此类问题,但是我到处寻找,但找不到解决方案。

我试图使用 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 target half_adder.o,', needed byaufgabe4.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

物价感观 2024-12-21 07:04:06
aufgabe4.out : half_adder.o, adder.o, program.o

删除逗号。

aufgabe4.out : half_adder.o adder.o program.o
aufgabe4.out : half_adder.o, adder.o, program.o

Remove the commas.

aufgabe4.out : half_adder.o adder.o program.o
泪之魂 2024-12-21 07:04:06

从 makefile 的第一行中删除“,”。

Remove "," from the first makefile line.

葬花如无物 2024-12-21 07:04:06

你的 Makefile 的第一行写得不好。修改为:

aufgabe4.out : half_adder.o adder.o program.o

不能使用逗号分隔目标。仅使用空格。

The first line of your Makefile is badly written. Modify it to this:

aufgabe4.out : half_adder.o adder.o program.o

You can't use comma to separate the targets. Use spaces only.

淡莣 2024-12-21 07:04:06

您的 make 可能是 GNU make,您可以使用 make --debug 对其进行调试=b

Your make is probably a GNU make, you might debug it using make --debug=b

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文