Problem
Why is compiling a program that has a main function int main(void)different from compiling a program that has a main function int main(int argc, char *argv[])if the program does not use the arguments passed on the command line?
Is this OS or compiler specific? I am not getting the same results using mingw and g ++ (which is strange, isn’t it that wingw is a gcc port).
Example
The code
#include <iostream>
#include"SDL/SDL.h"
int main(void)
{
return 0;
}
Compilation commands
g++ test.cpp; #g++ 4.4.5
i586-mingw32msvc-g++ test.cpp; # mingw 4.4.4
Error
(set by the second command.)
a(main.o):(.text+0x85): undefined reference to `_WinMain@16'
source
share