解决RT-Thread Studio编译错误的有效方法

一、unknown type name ‘uint8_t’

解决办法:添加#include<stdint.h>头文件

二、expected declaration specifiers or ‘…’ before numeric constant

解释:这个错误提示意思是在数字常量之前缺少声明说明符或者有语法错误。可能是在定义变量或函数时出现了问题。需要检查代码中是否有语法错误或者缺少必要的声明说明符。
错误原因:此次是由于编译器定义的环境不同,移植的时候使用的是在另一个环境下的定义

#if defined   (__GNUC__) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
#ifndef __ALIGN_END
#define __ALIGN_END    __attribute__ ((aligned (4)))
#endif /* __ALIGN_END */
#ifndef __ALIGN_BEGIN  
#define __ALIGN_BEGIN
#endif /* __ALIGN_BEGIN */
#else
#ifndef __ALIGN_END
#define __ALIGN_END
#endif /* __ALIGN_END */
#ifndef __ALIGN_BEGIN      
#if defined   (__CC_ARM)      /* ARM Compiler */
#define __ALIGN_BEGIN    __align(4)
#elif defined (__ICCARM__)    /* IAR Compiler */
#define __ALIGN_BEGIN 
#endif /* __CC_ARM */
#endif /* __ALIGN_BEGIN */
#endif /* __GNUC__, ARM Compiler 6 */

三、macro “Error_Handler” passed 1 arguments, but takes just 0

解释:宏“Error_Handler”传递了1个参数,但只接受了0个
原因:在两个头文件中都定义了这个函数,结果一个带参数,一个不带参数,所以报错

物联沃分享整理
物联沃-IOTWORD物联网 » 解决RT-Thread Studio编译错误的有效方法

发表评论