-
New buggy problem
what does this error mean?
Code:
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)
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.
Don't werie about there not being comments I used as many as possible so I won't forget things.
~Trooper
-
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.
-
LOL!!!
Look atthis error Dev-c++ v4.9.8.0 gives me.
...
ROFL
~Trooper
-
>>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)
-
Code:
if(KEY_DOWN(VK_ESCAPE))
{
// If user presses ESCAPE then exit.
PostMessage(MAIN_WINDOW_HANDLE, WM_DESTROY,0,0);
}//end If
I get an error that says KEY_DOWN undeclared.
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.
~Trooper
-
Here are some more suggestions...
Remove all of the include lines except for this one:
Code:
#include <windows.h>
Add this at the top of the file, under the include files section
Code:
// Macros //////////////////////////////////////////////////////////////////
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x08000) ? 1 : 0)
Add a global variable in the section at the top
Code:
HWND main_window_handle;
Add this after the global variable section
Code:
// Function Declarations //////////////////////////////////////////////////////
int Game_Main(void);
int Game_Shutdown(void);
int Game_Init(void);
Add main_window_handle = hwnd; to WinMain after the return(0); that follows CreateWindowEx(). It should look like this:
Code:
// 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
return 0;
main_window_handle = hwnd; // <<<=== HERE
Remove the void *params from these functions
Code:
int Game_Main(void *params);
int Game_Shutdown(void *params);
int Game_Init(void *params);
They should all start like this:
Code:
int Game_Main()
int Game_Shutdown()
int Game_Init()
I also noticed that Game_Shutdown was mispelled as game_Shutdown in two places.
Rog