0
all: ship

ship: testShip.o ship.o
        g++ -g -Wall -o ship testShip.o ship.o 

testShip.o: testShip.cpp
        g++ -g -Wall -c testShip.cpp

ship.o: ship.cpp
        g++ -g -Wall -c ship.cpp 

clean:
        rm -rf *.o ship 

Does anyone know why I get the error: "Makefile:1: *** missing separator. Stop."? I googled and I did put a tab after the beginning of every line. Thanks!

Kevin Cheng
  • 115
  • 1
  • 4
  • 3
    I'm not sure what you mean by `after the beginning of every line`. Only the lines that contain recipes (the `g++` and `rm` lines) should have a TAB as the first character of that line. The target lines (that have the colon (`:`) in them) should not start with a TAB. – MadScientist Nov 13 '14 at 05:23
  • Yeah thats what I meant. Did i not do that? is there another problem? Thanks – Kevin Cheng Nov 13 '14 at 05:36
  • 2
    Given the makefile you've provided, you cannot get the error you've quoted. So, there's something else going on here which you haven't described to us. – MadScientist Nov 13 '14 at 06:01
  • yes, and by seeing the error output, we can say the problem is line 1, which is all ok as per the Makefile in the question. – Sourav Ghosh Nov 13 '14 at 06:08
  • Do you have a blank-looking line at the top of the file (before the `all:` line) that actually contains one or more spaces or tabs? – Jonathan Leffler Nov 13 '14 at 06:22

0 Answers0