User forums > Help

MingW: error: to few arguments to function 'void exit(1);

(1/2) > >>

laserbeak43:
hi,
i know that this is probalby the wrong place to post this, but i'm in the mingw chatroom on irc and it's pretty dead.

i'm getting an error, that says"error: to few arguments to function 'void exit(1)'" can someone please help me with this one?

thomas:
It is the wrong place, we're not a general programming forum.

But anyway, your error says just what it says: you use too few arguments (i.e. none at all).

Write exit(0); instead of exit(); and it will work.

Google man 2 exit for reference.

laserbeak43:
thanks i'll do that. cause the code i'm reading is telling me to type exit(1)

thomas:
That will work too, just exit() will not.

The function (found in stdlib.h) is void exit(int), i.e. it takes exactly one integer, which is returned as the exit code of your program (0 is standard for "no error"). The function does not return, obviously.

laserbeak43:
maybe it's cause i haven't cleaned the project before i re rean it... cause i use exit(1)

nope... no luck...

could it be because the code that i'm writting is C in a C++ project? wouldn't codblocks pick this up and use the necessary compiler?

Navigation

[0] Message Index

[#] Next page

Go to full version