Skip to main content
JBurg.5
Associate II
March 10, 2022
Solved

Hello, I have updated my STM32CubeIDE from V1.7.0 to V1.9.0. After that my project fails to link with > 40 000 "multiple definition of" errors. Before the project was compiling for years without such problems.

  • March 10, 2022
  • 6 replies
  • 3166 views

I chaecked the following:

There are no variable definitions in my headers. I use #ifndef/#define/#endif in all headers.

After 2 days of trying I don't know what to do anymore. What might have changed in V1.9.0?

This topic has been closed for replies.
Best answer by Nikita91

This is because you have variables definitions in .h files without extern.

GCC 10 changed this behavior.

You can add -fcommon to revert to the old behavior.

I didn't read carefully your question...

6 replies

TDK
March 10, 2022

Look at the error messages. It should tell you where something was first defined along with the definition it just came to. See why there are multiple definitions. Perhaps you have duplicate files in the directory.

"If you feel a post has answered your question, please click ""Accept as Solution""."
JBurg.5
JBurg.5Author
Associate II
March 10, 2022

Thank you for your support.

The error messages are shown for all my variables like this:

main.h:85: multiple definition of `hadc1'; Src\GUIConf.o:C:\Users\JB\STM32CubeIDE\workspace_1.3.0\VM100\Inc/main.h:85: first defined here

In all of them the part "Src\GUIConf.o" is the same.

I checked the file GUIConf.c. It doesn't seem to have any issues.

Nikita91
Nikita91Best answer
Lead II
March 10, 2022

This is because you have variables definitions in .h files without extern.

GCC 10 changed this behavior.

You can add -fcommon to revert to the old behavior.

I didn't read carefully your question...

JBurg.5
JBurg.5Author
Associate II
March 10, 2022

No, you were right! With -fcommon I can work again.

Thanks a lot!

Nikita91
Lead II
March 10, 2022

So have a look at the last answer of this post:

Issue with version 1.9.0? (st.com)

Javier1
Principal
March 22, 2022

same problem here, i spent a whole working day chasing ghosts.

Thanks @Nikita91​ 

hit me up in https://www.linkedin.com/in/javiermuñoz/