【发布时间】:2010-10-14 17:06:17
【问题描述】:
我有一个makefile如下:
CC = gcc
CFLAGS = -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" $(INCLUDES)
ifdef DEBUG
CFLAGS += -g3
endif
INCLUDES = \
-I../config.include \
-I../log.include \
-I../services.include
SRC_DIR = src
BIN_DIR = bin
BINARY = report
SRCS = $(shell ls $(SRC_DIR)/*.cpp)
OBJS = $(SRCS:%.cpp=%.o)
all: $(OBJS)
@mkdir -p $(BIN_DIR)
$(CC) $(OBJS) -o $(BIN_DIR)/$(BINARY)
clean:
rm -rf $(BIN_DIR) $(OBJS)
但是,当我运行 make 时,我得到了错误:
g++ -c -o src/report.o src/report.cpp
src/report.cpp:40:20: error: log.h: No such file or directory
src/report.cpp:41:28: error: services.h: No such file or directory
src/report.cpp:41:28: error: config.h: No such file or directory
我知道头文件在那里,并且它们被正确包含。路径也是正确的。 makefile 有问题,但我不知道是什么问题。
请注意,即使我设置 CC = gcc,输出始终是 g++。这不是一个错字,它实际上是我得到的输出 - 再次,不知道为什么。
救命!
【问题讨论】:
标签: c++ gcc makefile g++ compilation