4

It's my first time playing around with the Win32 API. What I'm trying to do is to make a simple window. I'm writing the code in Visual Studio 2019 on Windows 10 with all the required things installed to work with C++. The problem I'm having is that none of the code I found from searching around the web has worked, even just the simple wWinMain. Is there something I am doing completely wrong? or is there something special with VS2019 or Windows 10 in general?

I tried running the code from a bunch of different sources. Also tried manually running the code with the cl compiler from the terminal.

Code:

#include <windows.h>

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
    /* Some Code*/
    return 0;
}

Errors:

Warning C28251 Inconsistent annotation for 'wWinMain': this instance has no annotations.
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)  
Error LNK1120 1 unresolved externals

1 Answer 1

7

Change your application from "Console" to "Windows" Right click on project -> Properties -> Linker options -> System.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.