Showing results for 
Search instead for 
Did you mean: 

error from compiler (linker) - NUCLEO-F072

Associate II

Hi I m using F072 Nucleo bd, and compiler report the following errors but there was no syntax error from the code, can anyone advise?

22:08:09 **** Incremental Build of configuration Debug for project F072_GPS_ NEO-6M_i2c_LCD_16x2 ****
make -j8 all
arm-none-eabi-gcc -o "F072_GPS_ NEO-6M_i2c_LCD_16x2.elf" @"objects.list" -mcpu=cortex-m0 -T"C:\Users\user\Documents\________STM32\F072_GPS_ NEO-6M_i2c_LCD_16x2\STM32F072RBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="F072_GPS_" -Wl,--gc-sections -static -u _printf_float --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/uartRingBuffer.o:C:/Users/user/Documents/________STM32/F072_GPS_ NEO-6M_i2c_LCD_16x2/Debug/../Core/Src/uartRingBuffer.c:15: multiple definition of `huart1'; ./Core/Src/main.o:C:/Users/user/Documents/________STM32/F072_GPS_ NEO-6M_i2c_LCD_16x2/Debug/../Core/Src/main.c:49: first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:64: F072_GPS_ NEO-6M_i2c_LCD_16x2.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.

22:08:09 Build Failed. 2 errors, 0 warnings. (took 506ms)


It's not a syntax error, and it's not from the compiler.

The LINKER is complaining that you define things in multiple places, so

a) Don't understand how to use include/ source files properly

b) Don't understand how to use extern properly


Put the definition of a variable in ONE place, in a C source file. Put prototype for global variables in an include file with an extern property so the global can be accessed across multiple source files.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..