2021-07-20warning: no previous prototype for function ‘SystemInit‘ [-Wmissing-prototypes]

在使用Keil编译项目时遇到关于函数'SystemInit'的警告,提示没有之前的原型定义。该警告出现在main.c文件的第五行。解决方法是在魔术棒设置中将警告等级设为5,这样在有警告时默认不会报错。调整后重新编译,警告消除。

#include "stm32f10x.h"

void SystemInit()
{
	
}

int main()
{
	
}

错误展示:

Rebuild started: Project: led
*** Using Compiler 'V6.15', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Rebuild target 'Target 1'
main.c(5): warning: no previous prototype for function 'SystemInit' [-Wmissing-prototypes]
void SystemInit(void)
^
main.c(5): note: declare 'static' if the function is not intended to be used outside of this translation unit
void SystemInit(void)
^
static
1 warning generated.
compiling main.c...
assembling startup_stm32f10x_hd.s...
linking...
Program Size: Code=324 RO-data=320 RW-data=0 ZI-data=1632
".\Objects\led.axf" - 0 Error(s), 1 Warning(s).
Build Time Elapsed: 00:00:00 

 SystemInit函数是startup启动文件中的,经过百度,有警告,可能又和什么版本乱七八糟的有关吧

解决方法:点击魔术棒,选择5,有警告的时候默认是6

再次编译就没了 

*** Using Compiler 'V6.16', folder: 'D:\ZYK\Keil5\MDK536\ARM\ARMCLANG\Bin' Build target 'Target 1' ../Libraries/CMSIS/core_cm3.c(445): error: non-ASM statement in naked function is not supported uint32_t result=0; ^ ../Libraries/CMSIS/core_cm3.c(442): note: attribute is here uint32_t __get_PSP(void) __attribute__( ( naked ) ); ^ ../Libraries/CMSIS/core_cm3.c(465): error: parameter references not allowed in naked functions "BX lr \n\t" : : "r" (topOfProcStack) ); ^ ../Libraries/CMSIS/core_cm3.c(461): note: attribute is here void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) ); ^ ../Libraries/CMSIS/core_cm3.c(479): error: non-ASM statement in naked function is not supported uint32_t result=0; ^ ../Libraries/CMSIS/core_cm3.c(476): note: attribute is here uint32_t __get_MSP(void) __attribute__( ( naked ) ); ^ ../Libraries/CMSIS/core_cm3.c(499): error: parameter references not allowed in naked functions "BX lr \n\t" : : "r" (topOfMainStack) ); ^ ../Libraries/CMSIS/core_cm3.c(495): note: attribute is here void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) ); ^ ../Libraries/CMSIS/core_cm3.c(509): warning: no previous prototype for function '__get_BASEPRI' [-Wmissing-prototypes] uint32_t __get_BASEPRI(void) ^ ../Libraries/CMSIS/core_cm3.c(509): note: declare 'static' if the function is not intended to be used outside of this translation unit uint32_t __get_BASEPRI(void) ^ static ../Libraries/CMSIS/core_cm3.c(524): warning: no previous prototype for function '__set_BASEPRI' [-Wmissing-prototypes] void __set_BASEPRI(uint32_t value) ^ ../Libraries/CMSIS/core_cm3.c(524): note: declare 'static' if the
最新发布
08-20
评论 6
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值