News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

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

Started by laserbeak43, August 17, 2007, 07:05:56 AM

Previous topic - Next topic

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

laserbeak43

#4
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?

stahta01

Quote from: laserbeak43 on August 17, 2007, 08:58:16 AM
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?

Code::Blocks using MinGW GCC decides based on file extension. Is the file extension .c or .cpp?

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

laserbeak43

Quote from: stahta01 on August 18, 2007, 09:28:10 PM
Quote from: laserbeak43 on August 17, 2007, 08:58:16 AM
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?

Code::Blocks using MinGW GCC decides based on file extension. Is the file extension .c or .cpp?

Tim S

yeah i made a .cpp file to follow the book that i'm reading. it's funny cause the book tells me i need to know c++. i'll change it and see w hat happens.

in the advanced properties section, i changed the compiler options to C instead of CPP and it built itself so far. no i just gotta figure out what looks to be like a linker error to confirm it's working.