Thread: DirectInputCreate - unidentified???

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    DirectInputCreate - unidentified???

    This is stupid.

    MSVC tells me this:

    error C2065: 'DirectInputCreate' : undeclared identifier


    and yet I've included dinput.h and dinput.lib in my project. What the heck is going on? Starting to tick me off a bit here.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    #define DIRECTINPUT_VERSION 0x0700

    Or use DirectInput8Create

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    No, it says that DirectInputCreate is unidentified. I took out the #include <dinput.h> and then it said the same for DIRECTINPUT_VERSION and other identifiers found in dinput.h.

    None of the following work:

    DirectInputCreate()
    DirectInput8Create();
    DirectInputCreateEx();


    Think I'm running into stupid compiler problem as there is nothing wrong with my code.

    Thank you MSVC.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Code:
    #ifndef _DXINPUT_
    #define _DXINPUT_
    
    #include "DXEngine.h"
    #include <dinput.h>
    
    
    
    class DXInput:public DXEngine
    {
    	protected:
    		LPDIRECTINPUT lpdi;
    	public:
    		DXInput(void);
    		~DXInput(void) {if (lpdi) lpdi->Release();};
    };
    
    #endif
    Code:
    #include "DXInput.h"
    
    DXInput::DXInput(void)
    {
    	
    	if (FAILED(DirectInputCreate(MainInstance,DIRECTINPUT_VERSION,&lpdi,NULL)))
    	{
    		//error
    	}
    }

    Later I will throw exceptions when this does not work. However, the damn compiler won't call DirectInputCreate because it says its undefined which is bs because I checked dinput.h myself and its there. What is going on?

    MainInstance is a protected member of DXEngine in case anyone was wondering.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Please help me on this one geniuses. Bubba is all out of ideas and that does not happen very frequently.

    Ever been programming away having a very productive day and then wham! you hit some roadblock that...shouldn't be a roadblock.

    All www.gamedev.net examples are nearly identical to Andre Lamothe's. Something is amiss here and I gotta figure it out or I'm gonna pick up my system and chuck it out the window....well maybe not but you get the idea.

    I rarely am so impatient but I'm so close to getting the engine done and am anxious to begin work on actual game data for it.

    Help.


  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Fixed it.

    Thanks Fordy.

    I thought that DIRECTINPUT_VERSION was defined inside of dinput.h which is why none of this made sense. But I guess you must tell it which version you want to use so that the conditional compilations inside of dinput.h will allow you to use DirectInputCreate(). Kind of convoluted if you ask me.

    Anyways, thanks a million Fordy. I owe you big time!!!


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unidentified virus
    By iain in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 09-16-2004, 06:50 PM
  2. Old Laptop with unidentified hardware/software problem
    By windoze victim in forum Tech Board
    Replies: 2
    Last Post: 12-09-2002, 08:11 PM