cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple definition after update CubeIDE

DBrau.2
Associate III

Hi. Can you say me what mean that type of error.

The code is surely correct because I've been working on it. The errors showed up after updating CubeIDE to a new version and generating files from .ioc file in IDE.

c:\st\stm32cubeide_1.7.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/communication/sms.o:C:/master_g474ve/Debug/../Core/Inc/config.h:54: multiple definition of `config'; ./Core/Src/battery_charger.o:C:/master_g474ve/Debug/../Core/Inc/config.h:54: first defined here

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Probably this:

https://community.st.com/s/question/0D53W00001Pv3zASAR/multiple-definition-error-after-stm32cubeide-190-update

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

6 REPLIES 6
TDK
Guru

Is config.h a CubeMX generated file? Certainly neither sms.c nor battery_charger.c is.

Probably you have the "config" variable/function defined in config.h, which is being included in two compilation units, which leads to duplicate definitions.

Move your definitions into source files and keep only the declaration in the header.

> The code is surely correct because I've been working on it.

Not sure that logic tracks.

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Guru

Probably this:

https://community.st.com/s/question/0D53W00001Pv3zASAR/multiple-definition-error-after-stm32cubeide-190-update

If you feel a post has answered your question, please click "Accept as Solution".
DBrau.2
Associate III

Yes. It's answer to my question

gsaishivareddy
Associate II

Please go through https://gcc.gnu.org/gcc-10/porting_to.html

In STM32CubeIDE, Goto Project Properties-> --> C/C++ Build -->Settings--> MCU GCC Compiler--> Miscellaneous--> other flags --> Add -fcommon    Apply and Close.

Hope this will help.

Hallo Mitarbeiter II, das hat bei mir geholfen, es kam die Fehlermeldung, einer doppelten Definition in einer  .o Datei.

-fcommon eingetragen, und keine Fehlermeldung mehr, GENIAL. Was bewirkt dieser Eintrag ? Danke nochmal von ganzem Herzen. Liebe Grüße

Habe gerade den Link gelesen, alles klar, danke.