“重复符号”;buf_位置“;在C语言代码中

“重复符号”;buf_位置“;在C语言代码中,c,microcontroller,C,Microcontroller,在这个程序中,我得到的错误是在C..\async.obj中复制了符号“\u buf\u position” 我已经声明buf_position是一个全局变量,我不知道这段代码有什么问题,请有人看一下 //异步.h文件 extern uint8_t buffer[10]; extern uint32_t buf_position = 0; extern uint8_t local_buff[10]; extern uint32_t retVal; //async.c文件 #include "a

在这个程序中,我得到的错误是在C..\async.obj中复制了符号“\u buf\u position” 我已经声明buf_position是一个全局变量,我不知道这段代码有什么问题,请有人看一下

//异步.h文件

extern uint8_t buffer[10];
extern uint32_t buf_position = 0;
extern uint8_t local_buff[10];
extern uint32_t retVal; 
//async.c文件

#include "async.h"
void Transmit_Data(void)
{ 
.............
...........
}

void Excep_SCI0_RXI0(void)//This is a recive interrupt,when some data is available on serialport
{

  buffer[buf_position++]= SCI0.RDR;
}
//main.c

#include "async.h"

void main(void)
{
    while(buffer[buf_position-1]=='\r')
    {
        memcpy(local_buff,buffer,buf_position-1);
        Display_LCD(LCD_LINE1, local_buff);
        Transmit_Data(); 
        buf_position = 0;
        //memset(buffer,0,sizeof(buffer));
    }
}

在包含
async.h
的每个文件中定义
buf\u位置。在
async.h
中删除初始化:

extern uint32_t buf_position;
现在你只是在声明

async.c
中,添加初始化:

#include "async.h"

uint32_t buf_position = 0;
uint8_t buffer[10];
uint8_t local_buff[10];
uint32_t retVal;

在包含
async.h
的每个文件中定义
buf\u位置。在
async.h
中删除初始化:

extern uint32_t buf_position;
现在你只是在声明

async.c
中,添加初始化:

#include "async.h"

uint32_t buf_position = 0;
uint8_t buffer[10];
uint8_t local_buff[10];
uint32_t retVal;