【发布时间】:2015-08-08 19:36:31
【问题描述】:
我在包含 inttypes.h 的库中有一个头文件(使用 PRIu8 等时需要)。我将库头文件包含到我自己的应用程序文件中。
当我尝试在 lpcxpresso(基于 eclipse)中使用 arm-none-eabi-gcc 进行编译时,出现错误
inttypes.h: No such file or directory
构建命令是
arm-none-eabi-gcc -std=c99 -DDEBUG -D__CODE_RED -DCORE_M3 -D__USE_CMSIS=CMSISv1p30_LPC17xx -D__LPC17XX__ -D__REDLIB__ -I"some include" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"src/KISS_Server.d" -MT"src/KISS_Server.o" -MT"src/KISS_Server.d" -o "src/KISS_Server.o" "../src/KISS_Server.c"
为什么会出现这个错误?
我正在尝试为具有 Cortex-M3 处理器的 LPC1769 进行编译
【问题讨论】:
-
你试过
find /usr/inclue -name inttypes.h吗? -
如果我在 linux 上为 x86 构建,那应该给我包含,对吗?但是,由于我是为 arm 构建的,所以这将是一个不同的文件,对吧?
-
我确实找到了 ~/Documents/LPCX/lpcxpresso/tools/arm-none-eabi/include/c++/4.9.3/tr1/inttypes.h 和 ~/Documents/LPCX/lpcxpresso/tools /arm-none-eabi/include/inttypes.h 虽然
-
尝试将包含路径添加到编译器命令中,例如
-I${HOME}/Documents/LPCX/lpcxpresso/tools/arm-none-eabi/include。 -
@iharob - 这应该可行,但我正在寻找一个更优雅的解决方案来暴露潜在问题。在 -std=c99 下,编译器不应该抱怨 inttypes.h