VS2015 issues with 2.0.8 _SDL_uft8

Using VS2015 Enterprise on Windows 10, and I’m having a bunch of issues with getting even a basic program to compile.

I’ve properly linked the .lib files (for the VS variant from the SDL download page), set the include file, defined the #include, ensured I haven’t mixed the bit-types of the libs/dlls, and I’ve got the main line as ‘int main(int argc, char *argv[], char *envp[])’ as Microsoft has recommended @ https://msdn.microsoft.com/en-us/library/17w5ykft.aspx.

The only other source on the internet that I’ve found having the same linker issue was over @ https://trac.wildfiregames.com/ticket/3138 for SDL 2.0.4.

Does anyone have any suggestions for what I could possibly do to fix (or just bypass) this issue?

By default, SDL expects the standard C main function with two arguments:

int main(int argc, char * argv[]);

If you want to use the other C or platform specific entry points, you can define SDL_MAIN_HANDLED before you include SDL.h. The SDL header then won’t define the macro that rewrites main to SDL_main which is what SDL2main.lib will call back into once the UTF-8 conversions of the arguments has finished. Handling main yourself means that linking to SDL2main.lib is not needed, but you must now also do the UTF-8 conversion (if you need/want to).

I hope that clears some things up. If it still doesn’t work, show us the error and the code that you try to compile. It will make it easier to help.

1 Like

Thank you VERY much, this has instantly fixed my problem.
I’ll make sure to research SDL_MAIN_HANDLED.