The sample code for this page doesn't work.

Jason Rempel 1 Reputation point
2020-04-23T07:42:42.267+00:00

[your-first-windows-program][1] [1]: https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first-windows-programI&#39

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.
35,959 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Li - MSFT 31,766 Reputation points Microsoft Vendor
    2020-04-23T09:54:42.223+00:00

    Hello,

    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
    2020-05-26T19:22:16.213+00:00

    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.

    -John

    0 comments No comments