KEIL5 错误提示 error: #20: identifier "uint8_t" is undefined
遇到 KEIL5 提示 error: #20: identifier "uint8_t" is undefined 问题与解决
源文件中红叉提示:

在项目中CTRL+F查找能够在stdint.h文件中找到

在网上查找解决方法,按照网上的方法,在文件中直接引用头文件#include "stdint.h",没有解决问题。
之后看到帖子想到.h文件顺序问题
之前的库文件顺序:

修改之后的库文件的顺序:

经过编译成功解决。
KEIL5 错误提示
compiling main.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\User\main.c: 0 warnings, 5 errors
compiling task_motor.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\User\task_motor.c: 0 warnings, 5 errors
compiling bsp.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\bsp.c: 0 warnings, 5 errors
compiling motor.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\motor.c: 0 warnings, 5 errors
compiling spi.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.c: 0 warnings, 5 errors
compiling os_core.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_core.c: 0 warnings, 5 errors
compiling os_flag.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_flag.c: 0 warnings, 5 errors
compiling os_mbox.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_mbox.c: 0 warnings, 5 errors
compiling os_mem.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_mem.c: 0 warnings, 5 errors
compiling os_mutex.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_mutex.c: 0 warnings, 5 errors
compiling os_q.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_q.c: 0 warnings, 5 errors
compiling os_sem.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_sem.c: 0 warnings, 5 errors
compiling os_task.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_task.c: 0 warnings, 5 errors
compiling os_time.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_time.c: 0 warnings, 5 errors
compiling os_tmr.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Core\os_tmr.c: 0 warnings, 5 errors
assembling os_cpu_a.asm...
compiling os_cpu_c.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Port\os_cpu_c.c: 0 warnings, 5 errors
compiling os_dbg.c...
..\..\BSP\spi.h(37): error: #20: identifier "uint8_t" is undefined
void SPIwbyte_1(uint8_t b);
..\..\BSP\spi.h(40): error: #20: identifier "uint32_t" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(40): error: #20: identifier "u8" is undefined
uint32_t SPIrbyte(u8 board);
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\BSP\spi.h(41): error: #20: identifier "uint8_t" is undefined
void SPIwbyte(uint8_t param,uint8_t Motor );
..\..\UCOS-II\Port\os_dbg.c: 0 warnings, 5 errors
".\Objects\STM32F10x_StdPeriph_Template.axf" - 85 Error(s), 0 Warning(s).
Target not created.

浙公网安备 33010602011771号