Reputation: 2134
I am brand new to make files and Boost
, and I'm trying to follow this tutorial, specifically Makefile4.
I only have two source files, namely S1.cpp
, where main.cpp
is located, and GaussQuadrature.h
. Now, GaussQuadrature.h
also uses a Boost
file, so (as far as I know) I must tell the compiler where Boost
is located, which is up two directories from where my source files are. My makefile is
CC=g++
CFLAGS=-o2 -std=c++0x
DEPS = GaussQuadrature.h
OBJ = S1.o
%.o: %.cpp $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
S1: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) S1.o -o S1 -I ../../boost_1_55_0
When I run the make command I get the error
makeS1:7: *** missing separator. Stop.
I've read this is most commonly due to missing tabs for the command (and it's interesting that when I hit 'tab' that the two commands are indented differently above), but even when I change those to
%.o: %.cpp $(DEPS)
\t$(CC) -c -o $@ $< $(CFLAGS)
S1: $(OBJ)
\t$(CC) -o $@ $^ $(CFLAGS) S1.o -o S1 -I ../../boost_1_55_0
I get the same error.
Other than fixing this error, what is proper way to include the Boost
directory in a makefile, or is there a way around including it altogether? Thanks!
Upvotes: 2
Views: 201
Reputation: 1628
It has nothing to do with Boost. Makefiles require tabs
http://www.delorie.com/djgpp/v2faq/faq22_17.html
Unlike most other DOS Make programs which accept any whitespace character at the beginning of a command in a rule, GNU Make insists that every such line begins with a TAB. (Most other Unix Make programs also require TABs, and the Posix standard requires it as well.) Make sure that the line whose number is printed in the error message (in this case, line 10) begins with a TAB.
Upvotes: 1