which lib do i have to include to use WPARAM?
don't i only need windows.h?
Printable View
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.
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?
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
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
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.
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.
I thought it was names beginning with an underscore followed by a capital letter (and maybe two underscores--i dont remember)Quote:
Originally Posted by Cat
Could you show us the rest of your files.
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.
Your error is in init.h. You have reversed LPARAM and WPARAM. It should read:Code:LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);
Found the error, turns out i had 2 bitmap.h and resource.h and in different directories and i included the wrong ones
the 1 i included was missing a semi-colon after i finished declaring a class
thanks for all the help