fatal error LNK1561: entry point must be defined

Hello, I have this error with Visual C++ 2008 express edition.
fatal error LNK1561: entry point must be defined

I'm writing an openGL program using SDL. Added both bin and include, also two lib files in VC++ project properties.

Got this SDL:
SDL-devel-1.2.14-VC8.zip (Visual C++ 2005 Service Pack 1)
from here:
http://www.libsdl.org/download-1.2.php

The code is here:
http://codepad.org/DYhImxXP


1
2
3
4
5
1
1>Linking...
1>LINK : fatal error LNK1561: entry point must be defined
1>Build log was saved at "file://c:\OSG\OSG\Debug\BuildLog.htm"
1>OSG - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Windows XP 64bit SP2.
Last edited on
Let me make a wild guess. Add this before main():
1
2
3
#ifdef main
#undef main
#endif 
Yes, that fixed it. Why does this have to be added in this case?
Last edited on
The SDL headers #define main as SDL_main. Ostensibly, so that a different library (SDLmain) can do some initializations in its own main(). I've never had any problems doing it this way, though, so I don't really see the point.
Last edited on
Topic archived. No new replies allowed.