which lib do i have to include to use WPARAM?
don't i only need windows.h?
which lib do i have to include to use WPARAM?
don't i only need windows.h?
Yes, windows.h should cover it (it's defined in windef.h--although you probably shouldn't explicitly include that file)
If you're having trouble with something, post the section of code that is causing a problem.
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
Code:#ifndef MAIN_H_INCLUDED #define MAIN_H_INCLUDED #include <windows.h> #include "resource.h" #include "init.h" #include "bitmap.h" WPARAM MainLoop(); extern HWND g_hWnd; extern HINSTANCE g_hInstance; _buffer g_buffer; HWND g_hWnd; HINSTANCE g_hInstance; #endif
10 K:\game\source\main.h `WPARAM' does not name a type
I don't see anything in that code that would cause your compile error (it's strange that you define your extern variables in the same file that they are declared, though)
Perhaps the error lies in one of your header files?
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
must be...
i brought WPARAM MainLoop(); down to the bottom and now it says HWND does not name a type
i'll see if i can find the mistake myself first, ill post the code when i need more help
those extern variables were declared somewhere else but i moved it into that file and 4got to remove the externs
Last edited by h_howee; 09-09-2006 at 07:14 PM.
The problem's caused by bitmap.h but i dont dont know where in the file it's from
Code:#ifndef BITMAP_H_INCLUDED #define BITMAP_H_INCLUDED #include <windows.h> class _buffer { public: HBITMAP LoadABitmap(LPSTR); void DisplayBitmap(HBITMAP hbmp, int x, int y, bool f); void DisplayBitmap(HBITMAP hbmp, int x, int y, RECT rportion, bool f); void ClearScreen(int color); private: HWND hWnd; HDC hdcFront; //HDC hdcBack; HDC hdcBitmap; }; #endif
Last edited by h_howee; 09-09-2006 at 10:51 PM.
Suppose it could be a problem with _buffer -- unless you're the author of the compiler you should never begin a class, variable, function, or constant with an underscore. In general anything beginning with _ or __ is reserved.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.
i changed _buffer to C_buffer but it still gives be the same error
If you have multiple files, look to the order of #includes; it may be that there's a conflict or that windows.h is not being #included in a way that you expect.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
I thought it was names beginning with an underscore followed by a capital letter (and maybe two underscores--i dont remember)Originally Posted by Cat
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
Could you show us the rest of your files.
Code:void function(void) { function(); }
resource.h
init.hCode:#define IDB_SHIP1_BMP 101 #define IDM_MENU 1000 #define IDMI_FILE_EXIT 1001
Code:#ifndef INIT_H_INCLUDED #define INIT_H_INCLUDED #include <windows.h> int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int); LRESULT CALLBACK WinProc(HWND, UINT, LPARAM, WPARAM); void init(HWND); void deinit(); HWND CreateMainWindow(HINSTANCE); #endif
void deinit(void);
I thought that sounded like a syntax error.
Code:void function(void) { function(); }
Your error is in init.h. You have reversed LPARAM and WPARAM. It should read:Code:LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);