Я пытаюсь скомпилировать свой код, но я получаю сообщение об ошибке «множественное определение», несмотря на то, что определяю свою переменную только в одном заголовке (например, «. \ Objects \ LCDADC.axf: Ошибка: L6200E: Символ Pin_D6 определен несколько раз (в lcd»)..o и main.o). ".)
Я использую Keil с LPC1768
main.c
#include <lpc17xx.h>
#include "LCD.h"
#include "Delay.h"
//Char LCD Pins
#define LCD_RS P2_0
#define LCD_RW P2_1
#define LCD_E P2_2
#define LCD_D4 P2_4
#define LCD_D5 P2_5
#define LCD_D6 P2_6
#define LCD_D7 P2_7
int main(){
SystemInit();
Delay_init();
LCD_Init(LCD_RS, LCD_RW, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
int main....
LCD.H
#include "Delay.h"
uint8_t Pin_RS;
uint8_t Pin_RW;
uint8_t Pin_E;
uint8_t Pin_D4;
uint8_t Pin_D5;
uint8_t Pin_D6;
uint8_t Pin_D7;
void LCD_Init(uint8_t rs, uint8_t rw, uint8_t e, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
....(More functions)
LCD.c
#include "LCD.h"
#include "GPIO.h"
#include "Delay.h"
void LCD_Init(uint8_t rs, uint8_t rw, uint8_t e, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
//Set Pin Numbers
Pin_RW = rw;
Pin_E = e;
Pin_RS = rs;
Pin_D4 = d4;
Pin_D5 = d5;
Pin_D6 = d6;
Pin_D7 = d7;
//Set port Directions
GPIO_PinDirection(Pin_D4, 1);
....(same for every pin and some command sending.)
}
....(Other Functions.)
(Извините за публикацию всего моего кода, но я считаю, что это важно и очень коротко в этом случае.)
Как вы можете видеть, я четко определил толькомои булавки только один раз.так почему он считает, что я определяю его несколько раз?