Click to See Complete Forum and Search --> : main is void, but gcc thinks it's an int...
HelicalCynic
03-27-2002, 08:33 PM
I keep getting the following error (compiling using 'g++ assignment4.cpp')
assignment4.cpp:22: `main' must return `int'
assignment4.cpp: In function `int main(...)':
and main is void!
void main(void)
{
Any ideas as to what's wrong with my gcc settings or my code?
Strike
03-27-2002, 08:41 PM
C++ standard dictates that main must return an int, so I guess it is changing it for you in memory :)
binaryDigit
03-27-2002, 09:09 PM
that's strange. i was just able to do that.
it does warn that it has changed the return type, but compiles if the -Wall option is not used during the compile
i'm willing to bet the answer for all of this lies somewhere in the specs file.
run gcc -v to find your specs file.
is there a reason main needs to return void in your program?
[ 27 March 2002: Message edited by: binaryDigit ]
s3raphim
03-31-2002, 06:48 PM
do this
int main()
{
blah;
return 0;
}