Skip to main content
gamedev.net
🔒 Locked

DirectInput Problems

Started by CloudNine May 22, 2003 at 2:25 PM 13 replies 950+ views
Original Post
CloudNine
CloudNine
Hi, I've been trying to implement DirectInput in my wrapper. I include dinput.h , and link to dinput.lib and dxguid.lib. I'm using the Dev C++ compatible header files for DirectX 8, and it comes up with a whole host of errors:
Line 645: syntax error before `;'
Line 657: syntax error before `;'
Line 1053: syntax error before `;'
  
I guess it's something to do with dxguid being included wrongly. Any ideas? CloudNine [edited by - CloudNine on May 22, 2003 3:27:09 PM]
chase_encode
chase_encode
I''m making my first wrapper class for direct input as well. I had some of the same problems.

First, you don''t have to link to the dxguid.lib if you put
#define INITGUID at the top of your main "implementation source file". This tells the compiler to get all the wonderful com GUID''s and IID''s. (Linking to the dxguid.lib is not wrong. Just giving you an alternative)

Second, make sure you include dinput.h before you include your class files. I found that the errors your describing come about because the compiler is not "understanding" the new variables/struct/class/interface such as LPDIRECTINPUT8.

If you still have problems with it e-mail me the source and I''ll take a look. chase_encode@hotmail.com

Colin Jeanne
Colin Jeanne
Download Dev-C++''s DirectX package. gcc will not work directly with the libs and headers from the SDK



Qui fut tout, et qui ne fut rien
Invader''s Realm
Dragon88
Dragon88
Oh, gee. Seems like I had some sort of problem like that too, but I can't remember the li[n]e numbers. Try inserting the line

typedef void* VARIANT;


before you include those files. Just a wild guess that probably wont work.




(Stolen from Programmer One)
UNIX is an operating system, OS/2 is half an operating system, Windows is a shell, and DOS is a boot partition virus

[edited by - Dragon88 on May 22, 2003 11:21:55 PM]
CloudNine
CloudNine
I''ve done all those things, but it still comes up with the same errors . (As I said, I''ve got the right package)
CloudNine
CloudNine
Here''s the whole of main.h, where I include the header files:


#ifndef Main_h
#define Main_h

//==================Includes======================//
#include <windows.h> //The windows header file
#define WIN32_LEAN_AND_MEAN
#include <d3dx8.h> //The DirectX 8 header file
#include <string.h> //String header file
#include <stdio.h> //Header for dealing with files
#include <stdarg.h> //Variable arguments header file
#include <dinput.h>
#define INITGUID

#include "CApplication.h" //Include our CDirectApplication class
#include "System.h" //Include the System functions
#include "CPrimitives.h" //Include the Primitives class
//================================================//

extern CGOApp cApp;

LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
void InitScene();
void Render();
#endif


Does this help?
Colin Jeanne
Colin Jeanne
quote:
Original post by CloudNine
Here''s the whole of main.h, where I include the header files:


#ifndef Main_h
#define Main_h

//==================Includes======================//
#include <windows.h> //The windows header file
#define WIN32_LEAN_AND_MEAN
#include <d3dx8.h> //The DirectX 8 header file
#include <string.h> //String header file
#include <stdio.h> //Header for dealing with files
#include <stdarg.h> //Variable arguments header file
#include <dinput.h>
#define INITGUID

#include "CApplication.h" //Include our CDirectApplication class
#include "System.h" //Include the System functions
#include "CPrimitives.h" //Include the Primitives class
//================================================//

extern CGOApp cApp;

LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
void InitScene();
void Render();
#endif


Does this help?


#define INITGUID before including the DirectX headers.



Qui fut tout, et qui ne fut rien
Invader''s Realm
parnen
parnen
Hmmm..

What is a WRAPER = I meen is that the correct name for a small program that does what?
Im not sure how to describe the WRAPER as I do not know what it is.

Sorry I write classes, exporting dll''s and trying on DX9 but im not really familar with this wraper thingy... explain.

// Guran
// Goran
Dreamforger
Dreamforger
Most APIs are very generalized description of what you can do with them. They are very powerfull but also very complex.
A common use of Wrappers is to provide a simpler, more application specific interface.

The other would be to create a single interface that stays the same independant of the API used.

For example you could design a general TEXTURE wrapper, which gets implemented as a DX_TEXTURE as well as a OGL_TEXTURE. The TEXTURE class exposes methods like ''enableTextureForNextRenderCall''. The DX_TEXTURE sets its DIRECTDRAWSURFACE object to the right stage, The OGL_TEXTURE instead does that glEnable(), glBindTexture, ... stuff both for the same call.

So whoever uses the texture, i.e engine, to create a programm needs not worry about wheter OGL or DX is in use.

---------------------------
I may be getting older, but I refuse to grow up
I may be getting older, but I refuse to grow up
CloudNine
CloudNine
Anyone else come accross this problem before? If so, what did they do?
chab
chab
I don't have an answer to your question but maybe something that could help you...

My code is working well without defining INITGUID before or after including dinput.h. This library is build as a DLL and I don't include anything else from DirectX or Windows in it.

BTW, I'm using GUID and I need to link the DLL with dxguid.lib.

[edited by - chab on May 24, 2003 5:04:09 AM]
CloudNine
CloudNine
I managed to fix it!

I typedef''ed a pointer to an unsigned int, and it solved my problems
chab
chab
Great

I remember something else... On a old hard drive, the headers were chronically corrupted and I got some strange errors like your one. Then, I had to patch DX and Windows headers :/.

Anyway, I''m glad you''re not stuck anymore.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.