You pass the linker options to invoke the compiler along with -c , which means that the connection is not made, and so the -l options are not used. In your case, your LIB_FLAGS should not be in FLAGS , but instead is specified in the rule main: ... :
main: main.cpp $(CC) $(FLAGS) $(LIB_FLAGS) ...
source share