New buggy problem
what does this error mean?
Man! This book is really making me mad. I copy the code from this book exacly and the program is all buggy. I"ll attach the .cpp file and you ppl take a look at it.
G3D_P1.cpp:33:19: fcnt1.h: No such file or directory
G3D_P1.cpp: In function `LRESULT WindowProc(HWND__*, unsigned int, unsigned
int, long int)':
G3D_P1.cpp:57: case label `15' not within a switch statement
G3D_P1.cpp:68: case label `2' not within a switch statement
G3D_P1.cpp:77: `default' label not within a switch statement
G3D_P1.cpp:55: break statement not within loop or switch
G3D_P1.cpp:66: break statement not within loop or switch
G3D_P1.cpp:75: break statement not within loop or switch
G3D_P1.cpp:77: break statement not within loop or switch
G3D_P1.cpp: At global scope:
G3D_P1.cpp:82: parse error before `return'
G3D_P1.cpp:153: parse error before `return'
G3D_P1.cpp: In function `int Game_Main(void*)':
G3D_P1.cpp:184: `KEY_DOWN' undeclared (first use this function)
G3D_P1.cpp:184: (Each undeclared identifier is reported only once for each
function it appears in.)
G3D_P1.cpp:187: `main_window_handle' undeclared (first use this function)
Don't werie about there not being comments I used as many as possible so I won't forget things.
Looks like you missed an if() statement not long after the comment
// enter main event loop
It is probably something like this...
if (msg.message != WM_QUIT)
...but it could be something different.
Also check that you have the curley braces in the right places around that part of the code.
The rest of the code looks right.
Look atthis error Dev-c++ v220.127.116.11 gives me.
>>what does this error mean?
>>G3D_P1.cpp:33:19: fcnt1.h: No such file or directory
Hmm, I'm not sure, but something's telling me the compiler can't find a file ;)
This is typical... you will see strange error messages when you have strange errors in your code. Compiler do not cope well with arbitrary input. When you decide to stop complaining about the compiler and get busy fixing your data entry errors you will see that there is nothing wrong with the compiler.
Your code has atleast two errors... I gave you one of them, now I'll give you another... there is no file named fcnt1.h, but there is a file named fcntl.h (as in "L" not 1)
I get an error that says KEY_DOWN undeclared.
// If user presses ESCAPE then exit.
And then is says MAIN_WINDOW_HANDLE undeclared. I wan't it so when the user presses ESCAPE it quits the game.
This is the last error for this part of my code lol. If I take out the If(KEY_DOWN) it works fine so thats one of my problems.
Here are some more suggestions...
Remove all of the include lines except for this one:
Add this at the top of the file, under the include files section
Add a global variable in the section at the top
// Macros //////////////////////////////////////////////////////////////////
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x08000) ? 1 : 0)
Add this after the global variable section
Add main_window_handle = hwnd; to WinMain after the return(0); that follows CreateWindowEx(). It should look like this:
// Function Declarations //////////////////////////////////////////////////////
Remove the void *params from these functions
// create the window
if (NULL == (hwnd = CreateWindowEx(
0, // extended style
WINDOW_CLASS_NAME, // class
"Geo 3D Game Engine V1.0 Alpha -- By Ryan Capote ©", // title
WS_OVERLAPPEDWINDOW|WS_VISIBLE, // window style
0,0, // initial x,y
800,600, // initial width, height
NULL, // handle to parent
NULL, // handle to menu
hInstance, // instance of this application
NULL))) // extra creation parms
main_window_handle = hwnd; // <<<=== HERE
They should all start like this:
int Game_Main(void *params);
int Game_Shutdown(void *params);
int Game_Init(void *params);
I also noticed that Game_Shutdown was mispelled as game_Shutdown in two places.