[英]GNU make doesn't include headerfile
我已經搜索了 6 個小時,但每次我嘗試通過 main.o 按順序編譯時,我似乎都找不到這個 GNU make 文件的問題
make main.o
它給了我這個錯誤:
arm-none-eabi-gcc -c main.c -mcpu=cortex-m4 -mthumb --
specs=nosys.specs -Wall -Werror -g -O0 -std=c99 -o main.o
main.c:23:22: fatal error: platform.h: No such file or directory
#include "platform.h"
^
compilation terminated.
Makefile:52: recipe for target 'main.o' failed
make: *** [main.o] Error 1
生成文件:
include sources.mk
# Platform Overrides
PLATFORM = MSP432
# Architectures Specific Flags
LINKER_FILE = msp432p401r.lds
CPU = cortex-m4
ARCH = thumb
SPECS = nosys.specs
# Compiler Flags and Defines
CC = arm-none-eabi-gcc
LD = arm-none-eabi-ld
TARGET = c1m1
LDFLAGS = -Wl,-Map=$(TARGET).map -T $(LINKER_FILE)
CFLAGS = -mcpu=$(CPU) -m$(ARCH) --specs=$(SPECS) -Wall -Werror -g -O0 -std=c99
CPPFLAGs =
.PHONY: all
all: $(TARGET).out
.PHONY: clean
clean:
rm -f $(OBJS) $(TARGET).out $(TARGET).map
%.o : %.c
$(CC) -c $< $(CFLAGS) -o $@
OBJS = $(SOURCES:.c=.o)
$(TARGET).out: $(OBJS)
$(CC) $(OBJS) $(CFLAGS) $(LDFLAGS) -o $@
來源.mk:
# Add your Source files to this variable
SOURCES =./main.c \
./memory.c \
./startup_msp432p401r_gcc.c \
./system_msp432p401r.c \
./interrupts_msp432p401r_gcc.c
# Add your include paths to this variable
INCLUDES =-I./include/CMSIS \
-I./include/common \
-I./include/msp432
這是我在 github 上的代碼:
您尚未在 makefile 的CFLAGS
宏中使用INCLUDES
宏。 因此arm-none-eabi-gcc ...
命令行沒有指定編譯器(或嚴格的預處理器)的包含路徑。
CFLAGS = -mcpu=$(CPU) -m$(ARCH) --specs=$(SPECS) $(INCLUDES) -Wall -Werror -g -O0 -std=c99
^^^^^^^^^^^
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.