How to include static library in makefile
c, gcc, linux, x86-64
Solution
CXXFLAGS = -O3 -o prog -rdynamic -D_GNU_SOURCE -L./libmine
LIBS = libmine.a -lpthread
Problem
I have the following makefile ``` CXXFILES = pthreads.cpp CXXFLAGS = -O3 -o prog -rdynamic -D_GNU_SOURCE -L./libmine LIBS = -lpthread -ldl all: $(CXX) $(CXXFILES) $(LIBS) $(CXXFLAGS) clean: rm -f prog *.o ``` I am trying to include the `./libmine` library within `CXXFLAGS`, but it seems like it is not the right way to include a static library, because when I compile the program, I get many undefined references error. So what is actually the right way to include a static library in the makefile?