Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

makefile, missing separator error

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

makefile:

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

I compile the program in cygwin and Ubuntu.

thanks

like image 610
Sam Avatar asked Dec 09 '12 14:12

Sam


People also ask

What does missing separator in Makefile mean?

The error you're encountering: *** missing separator (did you mean TAB instead of 8 spaces?). Stop. Means that the makefile contains spaces instead of Tab's. The make utility is notoriously picky about the use of Space instead of Tab .

What does $() mean in Makefile?

The $@ and $< are called automatic variables. The variable $@ represents the name of the target and $< represents the first prerequisite required to create the output file. For example: hello.o: hello.c hello.h gcc -c $< -o $@ Here, hello.o is the output file.


1 Answers

You need a real tab instead of space in front of g++ command, also you don't need to put function.h in g++ command.

all:
    g++ function.cpp  -o out
^^^ tab here  
like image 161
billz Avatar answered Oct 15 '22 10:10

billz