I'm having an issue where the following code can't be compiled using CL (VS CMD). Instead of Compiling, it gives me Error LN2019. Compiling the same Code inside VS, compiles without errors.
#include <windows.h>
LRESULT CALLBACK
MainWindowCallback( HWND Window,
UINT Message,
WPARAM WParam,
LPARAM LParam)
{
LRESULT Result = 0;
switch(Message)
{
case WM_SIZE:
{
OutputDebugStringA("WM_SIZE\n");
} break;
case WM_DESTROY:
{
OutputDebugStringA("WM_DESTROY\n");
} break;
case WM_CLOSE:
{
OutputDebugStringA("WM_CLOSE\n");
} break;
case WM_ACTIVATEAPP:
{
OutputDebugStringA("WM_ACTIVATEAPP\n");
} break;
default:
{
// OutputDebugSTringA("default\n")
Result = DefWindowProc(Window, Message, WParam, LParam);
} break;
}
return(Result);
}
int CALLBACK
WinMain(HINSTANCE Instance,
HINSTANCE PrevInstance,
LPSTR CommandLine,
int ShowCode)
{
WNDCLASS WindowClass = {};
WindowClass.style = CS_OWNDC|CS_HREDRAW|CS_VREDRAW;
WindowClass.lpfnWndProc = MainWindowCallback;
WindowClass.hInstance = Instance;
// WindowClass.hIcon;
WindowClass.lpszClassName = "FooWindowClass";
return(0);
}
I tracked down the issue to Line 36:
Result = DefWindowProc(Window, Message, WParam, LParam);
When i comment this line out, the file compiles just fine. The cl command used to Compile is also pretty standard:
cl -Zi Foo.cpp
Is there some cl parameter i missed?