[SDL] Dev C++ Linking Issues

Mike Frysinger vapier at gentoo.org
Thu Sep 29 19:56:41 PDT 2005

On Thursday 29 September 2005 10:37 pm, Tyler Montbriand wrote:
> On September 29, 2005 08:03 pm, Tim Swast wrote:
> > When I try to compile even a simple program with SDL, I get the error
> >
> > > [Linker error] undefined reference to `SDL_main'
> 1) It has to be int main(int argc, char *argv[]), not int main().
> SDL expects, nay, *demands* it take those two parameters.
> 2) If your main is in a C++ file, chances are your 'main' function is not
> really called 'main' as far as the linker's concerned, but
> 1502347xcgxf532189_main@ or some other garbage.  C++ mangles the names to
> prevent overloaded functions from having the same names.
> Fortunately, there's a way to tell C++ to do that.  Try:
>   extern "C" int main(int argc, char *argv[])
> instead of
>   int main()

this must be a VC++ thing then because linux doesnt require either of these

More information about the SDL mailing list