Skip to main content
Visitor II
August 8, 2024
Question

MX_RTC_Init undefined

  • August 8, 2024
  • 4 replies
  • 3573 views

Hi,

I'm getting this below compile time errors...

 

 

undefined reference to `MX_RTC_Init'

 

 

However, I have included the rtc.h header file, which contains the declaration of the MX_RTC_Init(void) function.

 

 

#include "main.h"
#include "cmsis_os.h"
#include "fdcan.h"
#include "i2c.h"
#include "lwip.h"
#include "rtc.h"
#include "spi.h"
#include "usart.h"
#include "usb_device.h"
#include "app_touchgfx.h"

 

 

Why does CubeIDE still giving me this error?

Thanks

 

    This topic has been closed for replies.

    4 replies

    Technical Moderator
    August 8, 2024

    Hello @iDeew and welcome to the ST Community :smiling_face_with_smiling_eyes:.

    Could you please share your .ioc file. Also, tell me the versions of CubeMX and CubeIDE that you are using.

    Best Regards.

    STTwo-32 

    iDeewAuthor
    Visitor II
    August 8, 2024

    You meant .ioc file?
    Pleas see attached.

    CubeMX 6.11.1
    CubeIDE v1.16.0

    Technical Moderator
    August 8, 2024

    Could you please try using the last version of CubeMX (V6.12.0).

    Best Regards.

    STTwo-32

    Super User
    August 8, 2024

    That's a linker error - not a compiler error.

     


    @iDeew wrote:

    I have included the rtc.h header file, which contains the declaration of the MX_RTC_Init(void) function.


    That's right: it contains only a declaration - not the definition.

    The error message said that it's the definition that's missing.

    The definition would be in the rtc.c source file - so check that's correctly included in the project ...

    iDeewAuthor
    Visitor II
    August 8, 2024

    Yes, you are correct. It is a Linker error.
    Any idea why I'm getting it?

    Thanks

    Super User
    August 9, 2024

    @iDeew wrote:

    Any idea why I'm getting it?


    Because the rtc.c source file - which contains the definition - isn't being built and/or isn't being linked.

    Is it present in your Project?

    As @STTwo-32 said, you could attach the Project...

    Technical Moderator
    August 9, 2024

    If you still have the same error. Can you send you project here. 

    Best Regards.

    STTwo-32

    ST Employee
    August 9, 2024

    This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.