Skip to main content
Visitor II
November 8, 2023
Solved

stm32f4xx.h warning: incompatible redefinitions

  • November 8, 2023
  • 3 replies
  • 3764 views

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.
    Best answer by jingqing3948

    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

     

    3 replies

    Graduate II
    November 8, 2023

    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

    Visitor II
    November 8, 2023

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

    jingqing3948AuthorAnswer
    Visitor II
    November 8, 2023

    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
    January 11, 2025

    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.