The sample code for this page doesn't work.

Jason Rempel 1 Reputation point

[your-first-windows-program][1] [1]:

On this page I was trying to learn how to use the Win32 API but I ran into a problem. When I compiled the complete code segment for a blank and basic window it does not build. Im using Visual Studio 2019 and on the Error List this is what it has to say:
LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke _main(void)" (?invoke_main@@YAHXZ)

I looked up the LNK2019 but I still cant find out what might be the issue. m very inexperienced with linker problems and with Win32 API. I know a bit about c++ but this is new territory for me. Some help would be greatly appreciated.; I don't know anything about the tags so it may be wrong

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
27,120 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Li - MSFT 29,356 Reputation points Microsoft Vendor


    Welcome to Microsoft Q&A!

    Currently, Microsoft Q&A is under a public preview. Not all topics are supported right now. All the supported topics are listed on the right top.

    Your question is about win32 API and it is not in the supported topics. I suggest that you could ask the question in General Windows Desktop Development Issues Forum.

    Thank you!

    0 comments No comments

  2. GrantMeStrength 1 Reputation point Microsoft Employee

    Hi -

    We (the docs team) just checked the sample and confirmed it's ok. It's possible your development environment is configured incorrectly? Perhaps a repair of the Visual Studio install might be a good place to start. Let us know if you can't get it working.


    0 comments No comments