Jump to content


Direct Input has gone crazy?


4 replies to this topic

#1 durban

    New Member

  • Members
  • Pip
  • 9 posts

Posted 08 September 2005 - 12:43 AM

I'm using the August update of the SDK which I have included dinput.h and dinput.lib correctly and the header file is intact. BUT when I try to call anything from versions 0x0800(version 8) or actually 0x0700 and above it doesn't get compiled. Here's a snippet of what I have added so far and fails miserably:

#include dinput.h -- removed carrots, html removes the whole thing

DirectInput8Create( g_Window.GetHInstance(), DIRECTINPUT_VERSION, IID_IDirectInput8,
  (void**)&_dinput, NULL);

and the errors:
c:\documents and settings\directx\cgraphics.h(25) : error C2146: syntax error : missing ';' before identifier '_dinput'
c:\documents and settings\directx\cgraphics.h(25) : error C2501: 'LPDIRECTINPUT8' : missing storage-class or type specifiers
c:\documents and settings\directx\cgraphics.h(25) : error C2501: '_dinput' : missing storage-class or type specifiers
c:\documents and settings\directx\cgraphics.h(26) : error C2146: syntax error : missing ';' before identifier '_dinputdevice'
c:\documents and settings\directx\cgraphics.h(26) : error C2501: 'LPDIRECTINPUTDEVICE8' : missing storage-class or type specifiers
c:\documents and settings\directx\cgraphics.h(26) : error C2501: '_dinputdevice' : missing storage-class or type specifiers
c:\documents and settings\directx\cgraphics.cpp(115) : error C2065: 'DirectInput8Create' : undeclared identifier
c:\documents and settings\directx\cgraphics.cpp(115) : error C2065: 'IID_IDirectInput8' : undeclared identifier
c:\documents and settings\directx\cgraphics.cpp(116) : error C2065: '_dinput' : undeclared identifier

It simply doesn't exist to the compiler, and after looking at the header file I noticed that DIRECTINPUT_VERSION is 0x0800 by DEFAULT! For some reason the compiler isn't processing it?

#define DIRECTINPUT_HEADER_VERSION  0x0800

#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION DIRECTINPUT_HEADER_VERSION
#endif

further down....

#if DIRECTINPUT_VERSION > 0x0700

extern HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter);

#else
extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter);
extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter);

My question is why do I have access to DirectInputCreateA() but not DirectInput8Create() when I have even specifically defined a version of 0x0800...I'm using VC++ but it has to be the compiler =\

#2 bladder

    DevMaster Staff

  • Moderators
  • 1057 posts

Posted 08 September 2005 - 03:34 AM

Quote

My question is why do I have access to DirectInputCreateA() but not DirectInput8Create()

No idea why that's happening :). Are you sure that you're not defining DIRECTINPUT_VERSION elsewhere? Or maybe including another library that defines it? Try defining it before you include anything else, at the very top of the file define it as 0x800.

Check that windows.h is included before anything else (it's actually supposed to be included before even the standard libraries). This *may* make a difference, I have found the order of including windows.h to be the culprit in some very aggravating cases.

#3 durban

    New Member

  • Members
  • Pip
  • 9 posts

Posted 08 September 2005 - 03:39 AM

Quote

No idea why that's happening :). Are you sure that you're not defining DIRECTINPUT_VERSION elsewhere? Or maybe including another library that defines it? Try defining it before you include anything else, at the very top of the file define it as 0x800.

Check that windows.h is included before anything else (it's actually supposed to be included before even the standard libraries). This *may* make a difference, I have found the order of including windows.h to be the culprit in some very aggravating cases.

View Post


I made a program that only uses directinput, that doesn't work.
The sample DirectInput programs that came with the SDK won't work also.
LPDIRECTINPUT8, DirectInput8Create() and anything with an 8 in it can't be found.

The compiler isn't reading the header correctly for some reason i assume =\

#4 Kippesoep

    New Member

  • Members
  • PipPip
  • 21 posts

Posted 08 September 2005 - 04:41 AM

Are you sure you haven't got an older version of the DirectX SDK installed, possibly the one that comes with Visual Studio itself, which ends up being used? Make sure that when you set up the include and library directories, they are at the top of the list, before the standard compiler directories.

#5 durban

    New Member

  • Members
  • Pip
  • 9 posts

Posted 12 September 2005 - 01:58 AM

Kippesoep said:

Are you sure you haven't got an older version of the DirectX SDK installed, possibly the one that comes with Visual Studio itself, which ends up being used? Make sure that when you set up the include and library directories, they are at the top of the list, before the standard compiler directories.

View Post


It was something with VC++ 6, I bought .NET 2003 yesterday and everything is fine now..still bugs me sometimes





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users