This can be done for the following reasons:
No library file selected in STM32CubeMX: When generating code in STM32CubeMX, if no library file is selected, a compilation error may occur.
No library file path configured in Keil 5: When compiling in Keil 5, if the library file path is not configured, it may cause a compilation error.
The library file generated in STM32CubeMX does not match the version of the library file in Keil 5: The library file generated by STM32CubeMX may not match the version of the library file in Keil 5, resulting in a compilation error.
To solve this problem, you need to check the library configuration in STM32CubeMX to make sure that the correct library is selected; Check the library file path in Keil 5 to make sure the configuration is correct; Make sure that the library file generated by STM32CubeMX matches the version of the library file in Keil 5.