This example code uses wWinMain
but
One thing to note is that Visual C++ supports a “wWinMain” entry point
where the “lpCmdLine” parameter is a “LPWSTR”. You would typically use
the “_tWinMain” preprocessor definition for your entry point and
declare “LPTSTR lpCmdLine” so that you can easily support both ANSI
and Unicode builds. However, the MinGW CRT startup library does not
support wWinMain, so you’ll have to stick with the standard “WinMain”
and use “GetCommandLine()” if you need to access command line
arguments.
via Building Win32 GUI Applications with MinGW
In this specific case, you can use WinMain
instead. This program doesn’t use pCmdLine
value, so it should compile when you change wWinMain
to WinMain
and PWSTR pCmdLine
to PSTR pCmdLine
.
If you later would need unicode command line use LPWSTR cmd_line = GetCommandLineW();
instead of WinMain
argument.
Newer Mingw versions also support -municode
linker option switching to alternate startup code allowing to use wWinMain
instead of WinMain
(or wmain
instead of main
). Add it to your command line, linker options in IDE or makefile.
g++ other_options_and_arguments -municode