-2

I'm new to macOS terminal commands and have recently got introduced to makefiles while learning to program in C++. The makefile that I was using had the following content:

 fact:factorial2.o facth.o
    c++ factorial2.o facth.o -o fact
 facth.o:facth.cpp
    c++ -c facth.cpp
 factorial2.o:factorial2.cpp
    c++ -c factorial2.cpp

All the files, factorial2.cpp and facth.cpp are present in the same folder as makefile.

On entering 'make' command in the terminal, I received the following:

makefile:2: *** missing separator.  Stop.

Kindly help me out with this and tell me where exactly I'm making the mistake as I'm not able to figure out the same. For my friends using Ubuntu, the above works perfectly.

Key76
  • 37
  • 6
  • 4
    Does this answer your question? [makefile:4: \*\*\* missing separator. Stop](https://stackoverflow.com/questions/16931770/makefile4-missing-separator-stop) – kiner_shah Nov 04 '21 at 10:47
  • 1
    Does this answer your question? [Make error: missing separator](https://stackoverflow.com/questions/920413/make-error-missing-separator) – Ivan Vnucec Nov 04 '21 at 10:57

1 Answers1

3

Makefiles use tab delimeters rather than 4 spaces. Replace the spaces with tabs on lines 2, 4, and 6.

user438383
  • 5,716
  • 8
  • 28
  • 43
Ivan Vnucec
  • 604
  • 1
  • 5
  • 17