Create a new Makefile file, copy the following content, directly use the make command in the project to okay
make
make clean
CC = g++
CFLAGS = -pthread
TARGET = TEST
DIRS = .
FILES = $(foreach dir, $(DIRS), $(wildcard $(dir)/*.cpp))
OBJS = $(patsubst %.cpp, %.o, $(FILES))
TARGETNAME := TEST
$(TARGET):$(OBJS)
$(CC) -o $(TARGET) $(OBJS) $(CFLAGS)
$(OBJS):%o:%cpp
$(CC) -c $< -o $@ $(CFLAGS)
clean:
-$(RM) $(TARGET) $(OBJS)