1

I'm trying to write a simple makefile, am getting missing separator:

CC =  g++
CFLAGS =  -Wall -g

all:  compile 

compile:  array.cpp
  $(CC) $(CFLAGS)  array.cpp

run:  ./result.out
George
  • 6,006
  • 6
  • 48
  • 68
Manu N
  • 21
  • 1
  • 1
  • 2
  • 1
    Does this answer your question? [makefile:4: \*\*\* missing separator. Stop](https://stackoverflow.com/questions/16931770/makefile4-missing-separator-stop) – Tejas Shetty Nov 04 '21 at 10:24

1 Answers1

15

Try

CC = g++ 
CFLAGS = -Wall -g

all: compile

compile: array.cpp
    $(CC) $(CFLAGS) array.cpp

run: 
    ./result.out

And make sure you use tabs for indentation, not spaces.

Vaibhav Sagar
  • 2,208
  • 15
  • 21
  • 2
    "And make sure you use tabs for indentation, not spaces." ==> this is what I need in my case! thank you – Diego D Sep 10 '20 at 13:41