0
我有下面給出的makefile。當我做make
我收到以下錯誤makefile找不到來自-I include路徑的頭文件
cc -c -o timing.o timing.c
test_c.c:5:17: fatal error: test.h: No such file or directory
#include "test.h"
我已經手動verfied是test.h
存在於../include
路徑。我不知道這是爲什麼不找頭file.It將是巨大的,如果有人能help.Also我期望的g++
代替cc
# Makefile template for shared library
CXX = g++ # C++ compiler
CXXFLAGS = -fPIC -Wall -Wextra -O2 -g -I../include #CXX flags
LDFLAGS = -lboost_system -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libtest.a # target lib
C_SRCS := test_a.c test_b.c
CPP_SRCS := test_c.cpp test_d.cpp
OBJS := $(C_SRCS:.c=.o) $(CPP_SRCS:.cpp=.o)
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CXX) $(CXXFLAGS) ${LDFLAGS} -o [email protected] $^
.PHONY: clean
clean:
-${RM} ${TARGET_LIB} ${OBJS}
〜
@alvits:你說得對,當我看到你的評論時,我正在糾正這個問題。 – Beta