undefined reference to 'mktime'

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

undefined reference to 'mktime'

2,380件の閲覧回数
iscan
Contributor II

I am unable to enable the mktime, localtime etc. functions.

 

This is what I have done:

1) I have opened the library project here: C:\Freescale\CW MCU v10.5\MCU\ARM_GCC_Support\ewl

2) Edited ansi-parms.h:

/* time and clock support */

     #ifndef _EWL_OS_TIME_SUPPORT

       #define _EWL_OS_TIME_SUPPORT 1        <---- this is the only thing I changed in the file.

     #endif

 

     #ifndef _EWL_CLOCK_T_AVAILABLE

       #define _EWL_CLOCK_T_AVAILABLE 1

     #endif

 

     #ifndef _EWL_TIME_T_AVAILABLE

       #define _EWL_TIME_T_AVAILABLE 1

     #endif

 

     #ifndef _EWL_TM_STRUCT_AVAILABLE

       #define _EWL_TM_STRUCT_AVAILABLE 1

     #endif

 

     #ifndef _EWL_TIME_T_IS_LOCALTIME

       #define _EWL_TIME_T_IS_LOCALTIME 1

     #endif

 

3) clean all

4) rebuild all.  Everything looks fine, no errors.

 

5) Then import my project again and clean/build. 

 

Same error. undefined reference to 'mktime' or whatever other time function I call.

The file date/time match the build time but the size of the libraries don't change.  I'm not sure how to rebuild the libraries to have the time (or other non-default) features enabled.

 

Does anyone have the same experience and a solution? Or just a solution? Direction?

 

Thanks in advance.

Ian

ラベル(1)
3 返答(返信)

1,680件の閲覧回数
egoodii
Senior Contributor III

I have 'cobbled together' a set of RTC functions for K that work(!).  It is 'seconds since 1/1/1970' based with appropriate 'calender conversions'.

1,680件の閲覧回数
iscan
Contributor II

Thanks Earl!  I appreciate your work on this. I'm setting up and testing it now.  Will let you know how it works out.

Ian

0 件の賞賛
返信

1,680件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello IAN:

As far as I know those time functions are not implemented because they would be dependent on the hardware. You would have to implement those functions by your own based on the device, using the RTC. The libraries contain that option because it is ANSI standard.

Regards!

Jorge Gonzalez

0 件の賞賛
返信