STM32编译出错 10
本人小白自学遇到问题求帮助#include"stm32f10x.h"#include"bsp_led.h"voidDelay(__IOu32nCount);intmain...
本人小白 自学遇到问题 求帮助
#include "stm32f10x.h"
#include "bsp_led.h"
void Delay(__IO u32 nCount);
int main(void)
{
LED_GPIO_Config();
while (1)
{
for(int A;A<4;++A)
{LED1(ON);
Delay(0x0FFFFFF);
LED1( OFF );
}
for(int B;B<3;++B)
{LED2(ON);
Delay(0x0FFFFFF);
LED2( OFF );
}
for(int C;C<2;++C)
{LED3(ON);
Delay(0x0FFFFFF);
LED3( OFF );
}
}
}
void Delay(__IO uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
这是主函数
然后编程的时候 就有问题 如下
..\..\User\main.c(30): error: #29: expected an expression
..\..\User\main.c(30): error: #20: identifier "A" is undefined
..\..\User\main.c(35): error: #29: expected an expression
..\..\User\main.c(35): error: #20: identifier "B" is undefined
..\..\User\main.c(40): error: #29: expected an expression
..\..\User\main.c(40): error: #20: identifier "C" is undefined
我在bsp_led.h里这样做的
#define A 1
#define B 1
#define C 1
是我定义错了么 ? 展开
#include "stm32f10x.h"
#include "bsp_led.h"
void Delay(__IO u32 nCount);
int main(void)
{
LED_GPIO_Config();
while (1)
{
for(int A;A<4;++A)
{LED1(ON);
Delay(0x0FFFFFF);
LED1( OFF );
}
for(int B;B<3;++B)
{LED2(ON);
Delay(0x0FFFFFF);
LED2( OFF );
}
for(int C;C<2;++C)
{LED3(ON);
Delay(0x0FFFFFF);
LED3( OFF );
}
}
}
void Delay(__IO uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
这是主函数
然后编程的时候 就有问题 如下
..\..\User\main.c(30): error: #29: expected an expression
..\..\User\main.c(30): error: #20: identifier "A" is undefined
..\..\User\main.c(35): error: #29: expected an expression
..\..\User\main.c(35): error: #20: identifier "B" is undefined
..\..\User\main.c(40): error: #29: expected an expression
..\..\User\main.c(40): error: #20: identifier "C" is undefined
我在bsp_led.h里这样做的
#define A 1
#define B 1
#define C 1
是我定义错了么 ? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询