Skip to main content
Associate II
August 8, 2024
Question

MX_RTC_Init undefined

  • August 8, 2024
  • 11 replies
  • 3621 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.

11 replies

STTwo-32
ST 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 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
iDeewAuthor
Associate II
August 8, 2024

You meant .ioc file?
Pleas see attached.

CubeMX 6.11.1
CubeIDE v1.16.0

STTwo-32
ST Technical Moderator
August 8, 2024

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

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Andrew Neil
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 ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
iDeewAuthor
Associate II
August 8, 2024

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

Thanks

Andrew Neil
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...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
STTwo-32
ST Technical Moderator
August 9, 2024

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

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Christian N
ST Employee
August 9, 2024

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