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
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 .
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.
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  
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With