Skip to main content
Associate
Nov 8, 2023 5:19 PM UTC
Solved

stm32f4xx.h warning: incompatible redefinitions

When I tried to compile a new project using the latest firmware lib function (in keil MDK-ARM uVision), I got these warnings:

jingqing3948_0-1699463785586.png

whether compiling my own project or the template project.

It seems like stm32f4xx.h has a lot of incompatible redefinitions? How can I fix this?

jingqing3948_1-1699463889291.png

 

This topic has been closed for replies.
jingqing3948Best answer
Associate
Nov 8, 2023 6:40 PM UTC

After review it, I know that in v1.8.1 stm32f4xx.h there is only one redefinition like this. So I delete the below section.

jingqing3948_0-1699468822143.png

 

4 replies

Tesla DeLorean
Guru
Nov 8, 2023 5:25 PM UTC

Yes, you're pulling content from two different include files. Perhaps you created with the Wizard?

Need to look very carefully at what Keil is pulling in vs what's in the ST libraries. Particularly CMSIS

ST's old SPL should have example MDK projects that should be more usable, and clone-able. With new MDK versions they'll want to use the version 6.xx compiler. most of the examples will expect 5.xx

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Associate
Nov 8, 2023 5:51 PM UTC

No I think the redefinitions only happened in stm32f4xx.h itself... like the second picture above.

jingqing3948AuthorBest answer
Associate
Nov 8, 2023 6:40 PM UTC

After review it, I know that in v1.8.1 stm32f4xx.h there is only one redefinition like this. So I delete the below section.

jingqing3948_0-1699468822143.png

 

Visitor II
Jan 11, 2025 7:09 AM UTC

I'm very curious why engineers have to write this macro definition more than once, and where can I see instructions and the like. .

Will deleting it directly castrate something?

*This post has been translated from Chinese to comply with the ST Community guidelines.