开发者

C warning implicit declaration of function 'exit'

开发者 https://www.devze.com 2022-12-22 03:25 出处:网络
This is my w开发者_如何学Carning. implicit declaration of function \'exit\' How i can remove it.

This is my w开发者_如何学Carning.

implicit declaration of function 'exit'

How i can remove it.

i am using linux & gcc compiler.


Add:

#include <stdlib.h>

to the top of your program.


Do you have this preprocessor? If not, add it.

#include <stdlib.h>


exit() is a library function, the respecive prototypes are present in the stdlib.h header file, inoder to call the process to specified code for exit function, you need to attach the as #include stdlib.h header in your program. that is the reason we should add the stdlib.h header. eventhough you can run the program, but it shows the warning message like below:

warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]      

but, this kind of program not recommended, we need to take care of what we are given in the program,be cautious. warning may leads runtime error.

0

精彩评论

暂无评论...
验证码 换一张
取 消