OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 2915|回复: 2

我按照原子库函数书来的为什么会报错

[复制链接]

4

主题

25

帖子

0

精华

初级会员

Rank: 2

积分
71
金钱
71
注册时间
2019-8-17
在线时间
21 小时
发表于 2019-8-17 22:50:43 | 显示全部楼层 |阅读模式
#include"stm32f10x.h"
void delay{u32 count}
{u32 i=0;
        for{;i<count;i++);
        }
        int main(void)
        {GPIO_InitTypeDef  GPIO_InitStructure;
                RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|
                RCC_APB2Periph_GPIOE,ENABLE);
                GPIO_InitStructure.GPIO_Pin=GPIO_Pin_5;
                GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
                GPIO_initstructure.GPIO_Speed=GPIO_Speed_50MHZ;
                GPIO_Init(GPIOB,&GPIO_InitStructure);
                GPIO_SetBits(GPIOB,GPIO_Pin_5);
                GPIO_InitStructure.GPIO_Pin=GPIO_Pin_5;
                GPIO_Init(GPIOE,&GPIO_InitStructure);
                GPIO_Setbits(GPIOE,Gpio_Pin_5);
                while(1)
                {gpio_ReSetBits(GPIOB,GPIO_Pin_5);
                        GPIO_setbits(GPIOE,GPIO_Pin_5);
                        delay(3000000);
                        GPIO_setbits(GPIOB,GPIO_Pin_5);
                        GPIO_restbits(GPIOE,GPIO_Pin_5);
                        delay(3000000);
                        }}
Build target 'template'
compiling main.c...
main.c(2): error:  #70: incomplete type is not allowed
  void delay{u32 count}
main.c(2): error:  #65: expected a ";"
  void delay{u32 count}
main.c(24): warning:  #12-D: parsing restarts here after previous syntax error
                        delay(3000000);
main.c(25): error:  #169: expected a declaration
                        }}
main.c(29): warning:  #1-D: last line of file ends without a newline

main.c(29): warning: At end of source:  #12-D: parsing restarts here after previous syntax error
main.c: 3 warnings, 3 errors
compiling main.c...
main.c(2): error:  #70: incomplete type is not allowed
  void delay{u32 count}
main.c(2): error:  #65: expected a ";"
  void delay{u32 count}
main.c(24): warning:  #12-D: parsing restarts here after previous syntax error
                        delay(3000000);
main.c(25): error:  #169: expected a declaration
                        }}
main.c(29): warning:  #1-D: last line of file ends without a newline

main.c(29): warning: At end of source:  #12-D: parsing restarts here after previous syntax error
main.c: 3 warnings, 3 errors
"..\OBJ\template.axf" - 6 Error(s), 6 Warning(s).
Target not created.
Build Time Elapsed:  00:00:01
       
                       
                       

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

1

主题

882

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
3071
金钱
3071
注册时间
2018-2-7
在线时间
285 小时
发表于 2019-8-19 15:55:25 | 显示全部楼层
仔细检查你代码中的圆括号和大括号
回复 支持 反对

使用道具 举报

3

主题

808

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
3888
金钱
3888
注册时间
2017-3-7
在线时间
1694 小时
发表于 2019-8-19 19:27:23 | 显示全部楼层
c语言基础问题
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-19 07:38

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表