2021-08-19 12:22 AM
I'm beginner and trying to write a driver for GPIO and received this error when compiling code.
What do I do wrong when creating a structure?
A library #include <stdint.h> at the beginning of the code included!
typedef struct // RM -> Table 39. GPIO register map and reset values
{
volatile uint32_t MODER; // Address offset: 0x00
volatile uint32_t OTYPER; // Address offset: 0x04
volatile uint32_t OSPEEDR; // Address offset: 0x08
volatile uint32_t PUPDR; // Address offset: 0x0c
volatile uint32_t IDR; // Address offset: 0x10
volatile uint32_t ODR; // Address offset: 0x14
volatile uint32_t BSRR; // Address offset: 0x18
volatile uint32_t LCKR; // Address offset: 0x1c
volatile uint32_t AFR[2]; // Address offset: 0x20-0x24 GPIO alternate function LOW register AF[1]: GPIO alternate function HIGH register AF[2]:
} GPIO_RegDef_t;
2021-08-19 12:26 AM
Sorry forgot a screen attach!
2022-08-30 7:48 AM
did u solve it??, i am stuck at same issue
2022-08-30 2:31 PM
You get this error because the compiler sees at least two conflicting declarations of the type.
The compiler tells you where exactly it finds the other definition. Just read carefully what it tells you.
2022-09-01 4:35 AM
sir, its not showing anything
2022-09-02 4:51 AM
Hmm.. have you tried to compile it, or just the editor shows the mark? (why "No consoles to display"?)
2024-03-26 8:39 AM - edited 2024-03-26 8:41 AM
Hey, check again your header file. I think you included another header file in this where shouldn't be included any header file. Remove that and build again.
2024-05-17 7:56 PM
Greetings, I have solved this problem by deleting 1 "#include stm32f407xx.h" in the driver.c file. Therefore, the general header file (stm32f407xx.h) is only included once in the driver.h file. Hope it helps!