It’s been a few years since I compiled the code for the first eBook and I needed to create an SDL application on Windows. I copied a project, as it was the fastest way to setup the include and lib paths, and the lib files needed to compile.
Compared to clang/gcc on Linux, setting up visual studio projects on Windows can be a bit of a pita. You’ve got to be careful not to mix up the x64 and x86 files, add everything twice (once for Win 32 and once for x64).
So I copied .sln and .vcxproj files, started compiling and kept getting this error:
Error LNK2019 unresolved external symbol main referenced in function “int __cdecl invoke_main(void)” (?invoke_main@@YAHXZ) maze D:\development\LinuxFormat\maze\MSVCRTD.lib(exe_main.obj)
I messed around with settings, still no joy. did a bit of searching around and found that some people fixed it by setting the Link System Subsystem but that didn’t fix it. Also one person had forgotten to add SDL2_main.lib to the list of lib files to be linked in.
Then I noticed the project was defaulting to 64-bit. I checked my includes and it was only setup for 32-bit. D’oh. So copying the settings from 32-bit to 64-bit fixed it.