DirectInput

Started by
3 comments, last by ETFBlade 20 years, 2 months ago
Hey guys, I had previously written a working directinput class, with initialization, shutdown, and keychecking functions. The problem was, I had this all written in a single header file, definitions and all. Now that I''m trying to move this out into a seperate source file, I get an annoying error. The HWND main_window handle gives me the error that ''HWND'': missing storage-class or type specifiers. Does anyone know what could cause this? Thanks.
Advertisement
Your probably #defining the HWND variable after the place it is referenced. The order the files are looked at really matters in C and C++ (Personally I always thought that was stooopid because even in assembler on Amiga the compiler looked ahead).

I think the best solution is to keep all defines, globals and prototypes in headers or another c file that is included before any actual code.

Mark
Sound Effects For Game Developers
http://www.indiesfx.co.uk
Flatspace is here: The ultimate space adventure
http://www.lostinflatspace.com
The handles are declared in the keyboard class header file which is included before main. They are then initialized in their appropriate places.
Include windows.h within the header for your class; it is include guarded so you can include it more than once in your program. If you dont want to do that, be sure to include windows.h before your header for your class.

Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
Show some code.

-Peter
There are two inevitabilities in life: death and failure.-PoLiSh

This topic is closed to new replies.

Advertisement