Missing Something Obvious

I have a simple Windows program that I got from a tutorial. It's a basic message box. However, when I try to compile it, I get error LNK2019. I must be missing an include file, or a library file, or a variable definition. I wanted to post this in the Windows Programming section. But, for some reason, it won't go through. Here is the code in its entirety:

1
2
3
4
5
6
7
8
9
  //     Message Box Test Program

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	MessageBoxA(0,"Message here","Title Bar",0);
	return 0;
}
Compiler error messages typically contain specific information relevant to the problem. Always post the entire error message, verbatim, when asking for help. Never post only the error number - many posters won't recognize the issue by number and will not bother to look it up.

What is the entire error message?
Last edited on
Not that it makes much sense to me. But, here is the error text:


Error: LNK2019

Project: MsgBox 1

File: MsgBox 1\MSVCRTD.lib(exe_main.obj)

unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
Follow the instructions in this post

https://stackoverflow.com/a/23282379/2085046
Thanks. That fixed the problem. Took a bit of looking though. In my compiler, it was under the "Debug" menu. I don't know why it would have tagged this as a console app. I clearly selected the "Windows Win32 App" template.

My antivirus wasn't liking the .exe at first. But, it adjusted. That possibility was never mentioned in any of the tutorials.
Topic archived. No new replies allowed.