This happens if you’re compile/run a Windows app that has a WinMain function, but you chose “Console Application” INSTEAD of
“Windows Application” when you were creating the new project.
You fix this by right clicking on your PROJECT name, then picking the PROPERTIES dialog:
Then change the subsystem to WINDOWS:
to prevent that from happening, make sure you pick WINDOWS APPLICATION at the point where Visual Studio asks you whether you want a console app or a windows app!: