Makefile Separator Error

I wrote a very simple makefile for a c++ program, but it returns a makefile:2: *** missing separator. Stop. error makefile:2: *** missing separator. Stop. makefile:2: *** missing separator. Stop. . What is wrong with him?

makefile :

 all: [tab]g++ function.cpp -o out 

I will compile the program in cygwin and Ubuntu .

thanks

+7
source share
4 answers

You need a real tab instead of the space before the g ++ command, also you do not need to embed function.h in the g ++ command.

 all: g++ function.cpp -o out ^^^ tab here 
+8
source

Instead of 4 (8?) Spaces, use <tab> at the beginning of the second line.

+3
source

As indicated here , the most common cause of this error is that lines are indented with spaces when make expects tabs.

+3
source

The second line should begin with a bookmark.

The first line is the target, then you define the rules below the goal. Rule lines must begin with a tab.

+2
source

All Articles