简单地说:它没有找到包含路径:
CC = g++
OBJS = *.o #*/*.o
DEBUG = -g
PNAME = game
INCLUDES = -Iheaders
CFLAGS = -Wall $(DEBUG)
LFLAGS = -Wall -lsfml-graphics -lsfml-window -lsfml-system $(DEBUG)
all: build
build: $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o $(PNAME)
clean:
\rm *.o *~ $(PNAME)
.cpp:
$(CC) $(CFLAGS) $(INCLUDES) -c $(.SOURCE)
答案 0 :(得分:5)
你的makefile看起来很糟糕。首先,您可能想要:
OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp))
其次,你的最终规则需要更像:
%.o: %.cpp
$(CC) $(CFLAGS) $(INCLUDES) -c $^ -o $@