I'm trying to learn C, and I'm stuck right at the beginning. To my knowledge, WinMain is the entry point to a GUI application in C. I'm running into issues trying to get it to work. This is the code I'm trying to run
#include <windows.h>
void foo(void) {
OutputDebugStringA("This is the first thing we have actually printed.\n");
}
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
)
{
foo();
}
These are the corresponding errors
C29251- Inconsistent annotation for 'WinMain': this instance has no annotations. See c:/filepath
LNK1120- 1 unresolved externals
LNK2019- Unresolved symbol main referenced in function "int_cdecl invoke_main(void)(?invoke_main@YAHXZ)
I've read through https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-winmain
I've tried the two separate code snippets provided, and neither ran on my computer.
I'm using Visual Studio