Hello all,
Thank you in advance for all help. I am new to the series, following along using CodeBlocks as me editor, but compiling the same way as the videos, using command line and VC CL. I keep getting errors saying:
error C3861: 'OutputDebugString': identifier not found
I googled this, as well as searched these forums but could not find an answer. I tried changing my include from windows.h to winbase.h, but that just introduced way more errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 | #include <windows.h>
LRESULT CALLBACK
Win32Procedure( HWND _window,
UINT _message,
WPARAM _wParam,
LPARAM _lParam )
{
LRESULT result = 0;
switch( _message )
{
case WM_SIZE:
{
OutputDebugStr( "WM_SIZE\n" );
} break;
case WM_DESTROY:
{
OutputDebugStr( "WM_DESTROY\n" );
} break;
case WM_ACTIVATEAPP:
{
OutputDebugStr( "WM_ACTIVEAPP\n" );
} break;
case WM_CLOSE:
{
OutputDebugStr( "WM_CLOSE\n" );
} break;
default:
{
result = DefWindowProc( _window, _message, _wParam, _lParam );
} break;
}
return result;
}
int CALLBACK
WinMain( HINSTANCE _instance,
HINSTANCE _prevInstance,
LPSTR _commandString,
int _commandShow )
{
TCHAR windowName[] = "Handmade";
WNDCLASS windowClass = {};
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hbrBackground = 0;
windowClass.hCursor = LoadCursor( NULL, IDC_ARROW );
windowClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
windowClass.hInstance = _instance;
windowClass.lpfnWndProc = Win32Procedure;
windowClass.lpszClassName = windowName;
windowClass.lpszMenuName = 0;
windowClass.style = CS_HREDRAW | CS_VREDRAW;
if( !RegisterClass( &windowClass ) )
{
MessageBox( NULL, TEXT( "Windows failed to register window." ), windowName, MB_ICONERROR );
return -1;
}
HWND window = nullptr;
window = CreateWindowEx( 0, windowClass.lpszClassName,
windowClass.lpszClassName,
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
0, 0,
_instance, 0 );
if( window == nullptr )
{
MessageBox( NULL, TEXT( "Windows failed to create window." ), windowName, MB_ICONERROR );
return -2;
}
for(;;)
{
MSG message;
BOOL messageResult = GetMessage( &message, 0, 0, 0 );
if( messageResult > 0 )
{
TranslateMessage( &message );
DispatchMessage( &message );
}
else
{
break;
}
}
return 0;
}
|
I am assuming this must be a compiler error? The only thing the video shows us linking to right now is user32.lib, which I am linking against. Thanks again for all help.