#ifdef __cplusplus
#define C_LINKAGE "C"
#else
#define C_LINKAGE
#endif /* __cplusplus */
/* The application's main() function must be called with C linkage,
and should be declared like this:
#ifdef __cplusplus
extern "C"
#endif
int main(int argc, char *argv[])
{
}
*/
#define main SDL_main
/* The prototype for the application's main() function */
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
Now, I've been using _tmain() from VC++ for months without problems, mostly because that #define gave me a linker error with main(), I'm guessing because I was avoiding SDLmain.lib (which I assume defines SDL_main()).
Do you think there'd be any problems if I use the regular main()?
That just seems wrong, redefining the word main! SDL documentation should tell you to call your main SDL_main and leave out the define. I'd just use SDL_main, making it obvious what's going on.
And still avoiding SDLmain.lib, I assume (there must be a main lurking in there). The only thing I'd worry about is what does the main in SDLmain.lib do (some kind of initialization) and is it necessary for what you need.
I have no idea what it does, but the program has been working correctly without it for several months in several systems without it, so I don't think it's something all that useful. At the very least, it doesn't seem to do anything I need. Either that or my users are not reporting issues (wouldn't be something unheard of, really. People prefer to complain rather than report).
By the way, the reason I'm avoiding SDLmain.lib is because it requires me to dynamically link to the runtime, and when I do, I get several conflicts between the runtime and the libraries, which I'm admittedly too lazy to resolve.
Today after writing several hundred lines of code I get a linker error about having no entry point and also about redefinition of main, always having something to do with this line #define main SDL_main
That's a good idea about undefining main.