在main函数,exti1.c(自己写的驱动文件)和stm32f10x_it.c都要用到
uint8_t PreemptionOccured=0;
uint8_t PreemptionPriorityVale=0;
NVIC_InitTypeDef NVIC_InitStructure;这三个变量
main函数的程序:
#include "stm32f10x.h"
#include "led.h"
#include "exti1.h"
void Delay(__IO uint32_t nCount);
int main(void)
{
LED_GPIO_Config();
EXTI1_GPIO_Config();
while(1)
{
if(PreemptionOccured!=0)
{
GPIO_WriteBit(GPIOA,GPIO_Pin_7,(BitAction)(1-GPIO_ReadOutputDataBit(GPIOF,GPIO_Pin_7)));
Delay(100);
GPIO_WriteBit(GPIOA,GPIO_Pin_8,(BitAction)(1-GPIO_ReadOutputDataBit(GPIOF,GPIO_Pin_8)));
Delay(100);
}
}
void Delay(__IO uint32_t nCount)
{
for(;nCount != 0; nCount--);
}
exti1.h的头文件:
#ifndef __EXTI_H1
#define __EXTI_H1
#include "stm32f10x.h"
uint8_t PreemptionOccured=0;
uint8_t PreemptionPriorityVale=0;
NVIC_InitTypeDef NVIC_InitStructure;
void EXTI1_GPIO_Config(void);
#endif
为什么我在编译的时候会报错:重复定义?
..\..\Output\ISO-STM32.axf: Error: L6200E: Symbol PreemptionOccured multiply defined (by exti1.o and main.o).
..\..\Output\ISO-STM32.axf: Error: L6200E: Symbol PreemptionPriorityVale multiply defined (by exti1.o and main.o).
..\..\Output\ISO-STM32.axf: Error: L6200E: Symbol NVIC_InitStructure multiply defined (by exti1.o and main.o).
"..\..\Output\ISO-STM32.axf" - 3 Errors, 0 Warning(s).
在主函数我并没有再次定义这三个变量:PreemptionOccured, PreemptionPriorityVale,NVIC_InitStructure这三个变量,为什么会出现报错? |