Reputation: 15
I am working on a project and decided to use Boost's regex classes. So I compiled only the regex class and moved libboost_regex.a to a subfolder regex in my project dir. How can I get this file linked?
I have the following makefile:
rm=/bin/rm -f
CC= clang++
PROGNAME= story
CFLAGS= -L ./regex
LIBS=-llibboost_regex
SRCS = main.cpp Environment.cpp
OBJS = main.o Environment.o
.cpp.o:
$(rm) $@
$(CC) $(CFLAGS) -c $*.cpp -o $*.o
all: $(PROGNAME)
$(PROGNAME) : $(OBJS)
$(CC) $(CFLAGS) -o $(PROGNAME) $(OBJS) $(LIBS)
Can anybody help me with this?
Thanks
Upvotes: 1
Views: 102
Reputation: 141770
These two lines:
CFLAGS= -L ./regex
LIBS=-llibboost_regex
Should be:
LDFLAGS= -L./regex
LIBS= -lboost_regex
LDFLAGS
being for the linker and the lib
prefix not being needed for libraries.
Upvotes: 1
Reputation: 16718
The easiest way in your case is probably just:
LIBS=-L./regex -lboost_regex
or
LIBS=./regex/libboost_regex.a
Upvotes: 1