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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

5,900 次查看
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 项奖励
回复
3 回复数

5,891 次查看
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 项奖励
回复

5,889 次查看
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 项奖励
回复

5,884 次查看
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