minGW: "No hay regla para hacer objetivo"

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 hay ninguna regla para hacer diana 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.

Gracias por su atención.

preguntado el 08 de noviembre de 11 a las 12:11

Is adder.o really depending on half_adder.cpp? Si adder.cpp only includes the half_adder.h file, then the .cpp file is not needed in the rule. -

Yes, adder.cpp relies on functions implemented in half_adder.cpp. I will remove the .cpp file from the rule, as you suggested. Thanks! -

4 Respuestas

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

Remove the commas.

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

respondido 08 nov., 11:16

Remove "," from the first makefile line.

respondido 08 nov., 11:16

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.

respondido 08 nov., 11:16

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

respondido 08 nov., 11:16

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.