关于keil 编译出现 warning: #1295-D: Deprecated declaration /函数/ - give arg types

版权声明:均是学习笔记、心得,如有冒犯,请指出,会及时处理。https://blog.csdn.net/qq_27485531 https://blog.csdn.net/qq_27485531/article/details/82860654

在声明函数时,如果该函数没有参数就要在括号里加“void”

例如

函数定义

void LED_GPIO_Init()
{
        GPIO_InitTypeDef  GPIO_Init_Struct;
        GPIO_Init_Struct.GPIO_Pin    = LED_GPIO_PIN;
        GPIO_Init_Struct.GPIO_Mode   = GPIO_Mode_OUT;
        GPIO_Init_Struct.GPIO_OType  = GPIO_OType_PP;
        GPIO_Init_Struct.GPIO_OSpeed = GPIO_Speed_50MHZ;
        GPIO_Init_Struct.GPIO_PuPd   = GPIO_PuPd_Pu;
    
        GPIO_Init(LED_GPIO_Port ,&GPIO_Init_Struct);
}
声明函数时为

void LED_GPIO_Init();

编译之后就会出现

warning:  #1295-D: Deprecated declaration LED_GPIO_Init - give arg types

如果声明函数为

void LED_GPIO_Init(void);

那么编译器则不会报警告。

猜你喜欢

转载自blog.csdn.net/qq_27485531/article/details/82860654