Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C warning implicit declaration of function 'exit'

Tags:

c

gcc-warning

This is my warning.

implicit declaration of function 'exit' 

How i can remove it.

i am using linux & gcc compiler.

like image 905
ambika Avatar asked Mar 09 '10 06:03

ambika


People also ask

What is implicit declaration of function warning in C?

Implicit declaration of functions is not allowed; every function must be explicitly declared before it can be called. In C90, if a function is called without an explicit prototype, the compiler provides an implicit declaration.

What does exit () do in C?

In the C Programming Language, the exit function calls all functions registered with atexit and terminates the program. File buffers are flushed, streams are closed, and temporary files are deleted.

What is incompatible implicit declaration?

If an implicit declaration does not match the built-in definition, you get this warning. To fix the problem, you have to declare the functions before using them; normally you do this by including the appropriate header.


2 Answers

Add:

#include <stdlib.h> 

to the top of your program.

like image 78
Greg Hewgill Avatar answered Sep 18 '22 11:09

Greg Hewgill


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

#include <stdlib.h> 
like image 27
shinkou Avatar answered Sep 17 '22 11:09

shinkou