I have been trying to create a basic application (in Visual Studio 2019, not Visual Studio Code) that would consist of a simple message box. I used the empty project template, and have nothing but the following file in the project:
//main.cpp
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nShowCmd) {
MessageBox(NULL, L"Goodman", L"Saul", 0);
return 0;
}
Much to my frustration, upon building the solution, it throws a LNK2019 error:
unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
I have looked online and all I could find were posts such as this one, which suggest changing the subsystem, which does not resolve the error.
Is there any way to fix this error?