Hello,
I am having a few problems when trying to execute the a Makefile that will hopefully create a static library that I can use for future use. Here is my code below:
#-----------------------------------------------------------------------------
# Usage of make file
#-----------------------------------------------------------------------------
# Clean operation:
# make -f MakeClient clean
#
# Make operation:
# make -f MakeClient
#
#
#OBJ = $(SRC:.cpp=.o)
OBJ_DIR = ./obj
OUT_DIR= ./lib
OUT_FILE_NAME = libclient.a
# include directories
# C++ compiler flags (-g -O2 -Wall)
CCFLAGS := -std=c++0x
# compiler
CCC = g++
# Enumerating of every *.cpp as *.o and using that as dependency
$(OUT_FILE_NAME): $(patsubst %.cpp,$(OBJ_DIR)/%.o,$(wildcard *.cpp))
$(CCC) -static $(LIB_DIR) $(LIBS) -o $(OUT_DIR)/$@ $^
#Compiling every *.cpp to *.o
$(OBJ_DIR)/%.o: %.cpp dircreation
$(CCC) -c $(CCFLAGS) -o $@ $<
dircreation:
@mkdir -p $(OUT_DIR)
@mkdir -p $(OBJ_DIR)
.PHONY : clean
clean:
rm -f $(OBJ_DIR)/*.o $(OUT_DIR)/$(OUT_FILE_NAME) Makefile.bak
And I get the following error(s):
g++ -c -std=c++0x -o obj/FFT.o FFT.cpp
g++ -c -std=c++0x -o obj/complex.o complex.cpp
g++ -static -o ./lib/libclient.a obj/FFT.o obj/complex.o
ld: library not found for -lcrt0.o
collect2: error: ld returned 1 exit status
make: *** [libclient.a] Error 1
The problem seems to be associated with this line:
# Enumerating of every *.cpp as *.o and using that as dependency
$(OUT_FILE_NAME): $(patsubst %.cpp,$(OBJ_DIR)/%.o,$(wildcard *.cpp))
$(CCC) -static $(LIB_DIR) $(LIBS) -o $(OUT_DIR)/$@ $^
But cannot figure what the problem is.
Hopefully someone can help,
Thanks :)