Original Post
When I enter this code from the Game Programming Genesis Part I: Beginning Windows Programming Tutorial, it gives me compiler errors. The problem is with the typdef struct WNDCLASSEX. can someone check to see what I did wrong? or what is typed wrong in the tutorial?
I'm using MSVC++ 6.0 with a Win32 Application project type.
Thanks!
The Compiler Errors are....
:\My Documents\WinGame\Wyrm.cpp(8) : error C2371: 'WNDCLASSEX' : redefinition; different basic types
c:\program files\microsoft visual studio\vc98\include\winuser.h(1177) : see declaration of 'WNDCLASSEX'
C:\My Documents\WinGame\Wyrm.cpp(25) : error C2143: syntax error : missing ';' before '.'
C:\My Documents\WinGame\Wyrm.cpp(25) : error C2501: 'GameWindow' : missing storage-class or type specifiers
C:\My Documents\WinGame\Wyrm.cpp(25) : error C2371: 'GameWindow' : redefinition; different basic types
C:\My Documents\WinGame\Wyrm.cpp(23) : see declaration of 'GameWindow'
C:\My Documents\WinGame\Wyrm.cpp(25) : error C2143: syntax error : missing ';' before '.'
C:\My Documents\WinGame\Wyrm.cpp(26) : error C2143: syntax error : missing ';' before '.'
C:\My Documents\WinGame\Wyrm.cpp(26) : error C2501: 'GameWindow' : missing storage-class or type specifiers
C:\My Documents\WinGame\Wyrm.cpp(26) : error C2371: 'GameWindow' : redefinition; different basic types
C:\My Documents\WinGame\Wyrm.cpp(23) : see declaration of 'GameWindow'
C:\My Documents\WinGame\Wyrm.cpp(26) : error C2143: syntax error : missing ';' before '.'
Error executing cl.exe.
~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
[edited by - Radagar on June 13, 2002 12:07:21 PM]
#include <windows.h>
#include <windowsx.h>
#include <conio.h>
#include <stdio.h>
#define WIN32_LEAN_AND_MEAN
typedef struct WNDCLASSEX {
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HANDLE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hBrush;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
HICON hIconSm;
} WNDCLASSEX;
WNDCLASSEX GameWindow;
GameWindow.cbSize = sizeof(WNDCLASSEX);
GameWindow.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
// ... ... ..
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
return 0;
}