Linking library in makefile
The problem is that -lboost_regex
is being placed before .o
s in the compiler command, unlike your single command which has -lboost_regex
at the end.
Change:
g++ -L /usr/lib/boost/lib -lboost_regex website.o data.o main.o -o a.out -lcurl
to:
g++ -L/usr/lib/boost/lib website.o data.o main.o -o a.out -lcurl -lboost_regex
See GCC Link Options for explanantion of why the order matters.