There are lots of hits when Google-ing this error. Here's one.
There's a mismatch between your C code and your VStudio project type.
Your app's entrypoint is probably int main(int argc, char **argv)
(this is one of its most general forms) which in MS world is corresponding to a Console application.
But MS has defined other application types. One of them is a GUI (window based) which doesn't require a console. For that one MS defined an entrypoint as:
int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
. You can find more details about it on MSDN.
When building the application's executable, the linker must know what type the application has. That is specified by the /SUBSYSTEM setting.
That is set when you create your (Visual C++) project based on your choice:
- Win32 Console Application
- Win32 Project
And I think the latter is the default.
In order to fix things, you need to change your linker setting to match your code (well there could be the other way around too, but that would be more complicated). In order to do that, in VStudio IDE go to your Project Properties -> Linker -> System -> SubSystem and change it from Windows (/SUBSYSTEM:WINDOWS) to Console (/SUBSYSTEM:CONSOLE).