MDK Keil5编译出现..\source\USART.c(35): error: #260-D: explicit type is missing (“int“ assumed)


   从STM32转战华大MCU(HDSC),移植正点原子关于串口部分的程序,笔者要把串口直接映射到 printf 函数上,这样方便调试,出现如下问题,但是在STM32上使用该程序编译却不会报错,笔者深感疑惑 ,也不知道是哪个环节除了问题。
   错误提醒:…\source\USART.c(35): error: #260-D: explicit type is missing (“int“ assumed)
   定义错误位置:

FILE __stdout;       
//定义_sys_exit()以避免使用半主机模式    
_sys_exit(int x) 
{ 
	x = x; 
} 

   定义 _sys_exit(int x) 以避免使用半主机模式,函数没有返回类型,假定其返回类型为int,可以写为 void _sys_exit(int x) ,否则编译器会默认为返回int类型,故会出现上述警告。
   解决办法:将_sys_exit(int x) 写成void _sys_exit(int x)
   感谢文章作者: https://blog.csdn.net/qq_40860986/article/details/88883523

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
引用\[1\]:#181-D…\HARDWARE\src\uart.c(399): warning: #181-D: argument is incompatible with corresponding format string conversion printf(“process msg:%s %d\r\n”,&Process_ptr,&Process_ptr);修改:参数与相应的格式字符串转换不兼容 。 引用\[2\]:#513…\HARDWARE\src\uart.c(396): error: #513: a value of type “u8 *” cannot be assigned to an entity of type “uint8_t” temp = USART2_RX_BUF;修改: 。 引用\[3\]:#1441-D…\HEADWARE\USBProcess\USBProcess.c(298): warning: #1441-D: nonstandard cast on lvalue (u8 *)send_buf\[193\] = acount_len\[0\];修改:非标强制转换 。 问题:user\API\LCD1.c(112): error: #171: invalid type conversion 回答: 根据您提供的引用内容,错误代码#171表示无效的类型转换。具体来说,这个错误可能是由于在user\API\LCD1.c文件的第112行进行了一个无效的类型转换导致的。要解决这个问题,您需要检查第112行的代码,并确保进行的类型转换是有效的。如果需要,您可能需要更改代码以使用正确的类型转换。 #### 引用[.reference_title] - *1* *2* *3* [stm32MDK错误码(不定时更新)](https://blog.csdn.net/I_O_fly/article/details/112184004)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

有资小家书小本

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值