Undefined reference to WinMain (C++ MinGW)

Newer Mingw versions 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 Older versions do not support this option. One thing to note is that Visual C++ supports … Read more

WINMAIN and main() in C++ (Extended)

About the functions. The C and C++ standards require any program (for a “hosted” C or C++ implementation) to have a function called main, which serves as the program’s startup function. The main function is called after zero-initialization of non-local static variables, and possibly but not necessarily (!, C++11 §3.6.2/4) this call happens after dynamic … Read more

What is a message pump?

A message loop is a small piece of code that exists in any native Windows program. It roughly looks like this: MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } The GetMessage() Win32 API retrieves a message from Windows. Your program typically spends 99.9% of its time there, waiting for Windows to tell … Read more

tech