-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.

2

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.