exit error

F

faz

Hai,

i have used exit(1) in my code and included conio.h file also but it
is giving the following..


error C2065: 'exit' : undeclared identifier

pls suggest me

regards,
faz
 
M

Michael DOUBEZ

faz a écrit :
Hai,

i have used exit(1) in my code and included conio.h file also but it
is giving the following..


error C2065: 'exit' : undeclared identifier

Use the following header insted
#include <cstdlib>

Michael
 
T

tony_in_da_uk

Hai,

i have used exit(1) in my code and included conio.h file also but it
is giving the following..

error C2065: 'exit' : undeclared identifier

pls suggest me

regards,
faz

Depending on the standards you want to comply with (e.g. POSIX, ...),
you might also want to use "exit(EXIT_FAILURE)". Google for details.
 
J

James Kanze

faz a écrit :
Use the following header insted
#include <cstdlib>

In which case he should (according to the current standard) use
std::exit(). For ::exit() (or just plain exit), it's
<stdlib.h>.

(I might add that you generally don't want to use this function
in C++, since it will cause the destructors of local variables
to be skipped.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,290
Messages
2,571,453
Members
48,129
Latest member
DianneCarn

Latest Threads

Top