Userdisplay12864.h(3): warning: #1295-D: Deprecated declaration IOInitOut - give arg types
Userdisplay12864.c(23): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIOInitOut"
编译时,出现好多这类型的警告和错误,不知道怎么回事啊。英语字面意思倒是理解了,但是,实际含义不清楚啊。
找了半天也没有找到错在哪里。求各位高手,帮忙解答啊。
先谢谢大家了。回去睡觉了。
唉。技术员累啊。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
---------------------------------
原子老师:我又试了一下。貌似,在函数外对全局变量赋值不行啊。其它情况,我不清楚。我遇到的情况是:
#include "stm32f10x.h"
#include "delay.h"
GPIO_InitTypeDef G;
G.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
G.GPIO_Mode = GPIO_Mode_Out_PP;
G.GPIO_Speed = GPIO_Speed_50MHz;
int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
GPIO_Init(GPIOC,&G);
delay_init(8);
while (1)
{
GPIO_SetBits(GPIOC,GPIO_Pin_0|GPIO_Pin_1);
delay_ms(4000);
GPIO_ResetBits(GPIOC,GPIO_Pin_0|GPIO_Pin_1);
delay_ms(4000);
}
}
编译时,要对
GPIO_InitTypeDef G;
G.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
G.GPIO_Mode = GPIO_Mode_Out_PP;
G.GPIO_Speed = GPIO_Speed_50MHz;
这三行报错如下:
Usermain.c(5): error: #77-D: this declaration has no storage class or type specifier
Usermain.c: G.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
Usermain.c: ^
Usermain.c(5): error: #147: declaration is incompatible with "GPIO_InitTypeDef G" (declared at line 4)
Usermain.c: G.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
Usermain.c: ^
Usermain.c(5): error: #65: expected a ";"
Usermain.c: G.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1;
Usermain.c: ^
每一行都对应这样的三个错误。一共8个错误。
如果把那 3 行放到主函数里面,就一个错误,警告,都没有了。
不知怎么回事??????????
一周热门 更多>