0

In trying to compile my makefile, I keep getting the same error message repeatedly:

Makefile:12: *** missing separator. Stop

I've removed the tabs, removed the spaces, deleted the makefile entirely and tried all over but I still get the same message. Please help.

CC = g++
CFLAGS = -std=c++11
TARGET = proj1.x
SOURCES = driver.cpp
    
proj1.x: driver.cpp
    g++ -std=c++11 -o proj1.x driver.cpp
        
.PHONY: clean
   
clean:
    rm -f proj1.x
1
  • 4
    The most common reason for this error is using spaces rather than tabs to indent recipes - check the clean recipe in particular Feb 12 at 14:52

1 Answer 1

4

As written in a comment, the problem here is almost certainly that you are not using Tab to indent the recipe instructions in your Makefile. You mention that, "I've removed the tabs", and this is a problem.

Converting your file to use tabs (not indents with other whitespace, but proper tabs, ASCII character 9), I confirmed that in my case the described error went away:

# Your makefile
make
  makefile:7: *** missing separator.  Stop.

# Convert indents to tab
mv -f makefile{,.old} && sed -E 's/^ {3,}/\t/' makefile.old >makefile

# Retry your makefile
make
  g++ -std=c++11 -o proj1.x driver.cpp
  […]

Not the answer you're looking for? Browse other questions tagged .