how to use #include <stdlib.h> and #include <time.h>?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use #include <stdlib.h> and #include <time.h>?

2,059 Views
donggeon
Contributor I

hello 

i know about to use new header file for generating random number.

In C language, 

#include <stdlib.h>

#include <time.h>

we just use this header file. but it can't work for this board.

for example, we have to add m to libraries to use math.h 

so how can i use  

#include <stdlib.h>

#include <time.h>

this header file?

0 Kudos
3 Replies

2,050 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

what is your target MCU? Typically small embedded systems doesn't have real time clock which is normally used as a seed for random generator on PC machine. What is your STD C library? EWL or NewLib? 

 

Jiri 

0 Kudos

2,048 Views
donggeon
Contributor I

STM32 Cortex®-M4 MCUs and MPUs programming manual

 

umm.. maybe this S32K144

캡처.PNG

 like this i want to add another header files.

0 Kudos

2,043 Views
jiri_kral
NXP Employee
NXP Employee

Hi,

I'm little bit lost. So, you can include header file into your code (like  #include <stdlib.h> )  - path for standard C headers is already configured for your project . For non-standard header files is compiler is looking in the paths specified in project properties: 

jiri_kral_0-1620642559253.png

 

Standard C functions are in STD C library. You don't need to add it - it is added by default. The Math library is special case - the version of libm.a depends on which float point type you are using. 

 

Jiri