So I'm trying to create a window in CodeBlocks using Win32, and so far only this version of WinMain works ( note: this is just a simple and naive example ):
#include <windows.h>
INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow ) {
MessageBox( NULL, "Title", "Message", MB_OKCANCEL );
return 0;
}
But this version does not:
#include <windows.h>
INT WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow ) {
MessageBox( NULL, "Title", "Message", MB_OKCANCEL );
return 0;
}
As far as I know, the latter expects the 3rd argument to be a pointer to a string of wide characters, while the former does not. But when I compile in CodeBlocks, all I get is this message:
undefined reference to WinMain@16
Apparently CodeBlocks is expecting the version of WinMain that doesn't receive a LPWSTR value as argument. My question is, how do I configure CodeBlocks so that it compiles with wWinMain?