Question

I am trying to use DirectInput to control camera movement on a small 3D application for a school project. I am using C++ on VS2010.

Per this link, I needed to link dxguid.lib and dinput8.lib on my project properties. So, I added them.

This led to VS2010 not being able to read dxguid.lib. Therefore, I had to download and install the DirectX SDK from Microsoft's download page. This led to the S1023 error, solved with Microsoft's solution.

I kept getting other compilation errors, and some searching led me to this site. And after doing that I now only get 2 unresolved externals:

error LNK2001: unresolved external symbol _IID_IDirectInput8W
error LNK2019: unresolved external symbol _DirectInput8Create@20

This is the relevant code, which was taken from the first link, with minor modifications:

bool GamePad::InitDirectInput(void)
{
    if(FAILED(DirectInput8Create(GetModuleHandle(NULL),
                             DIRECTINPUT_VERSION,
                             IID_IDirectInput8,
                             (void**)&m_pDIObject,
                             NULL)))
     {
     MessageBox(NULL,
            L"DirectInput8Create() failed!",
            L"InitDirectInput()",
            MB_OK);
    return false;
    }

    return true;
}

And every search I do returns to the same solutions provided above, or similar. I can't find something I haven't done. Can anybody provide an idea? Could the issue be that I am using Windows 8? Thanks in advance.

UPDATE

I managed to solve the first by using

#include <InitGuid.h>

But the second persists, to my frustration...

Was it helpful?

Solution

Make sure your include directories have this entry:

$(DXSDK_DIR)include

Now for Library directories set the following:

$(DXSDK_DIR)lib\x86

There is a known problem however with installing visual studio followed by the directx sdk. If the previous suggestions did not solve the problem try de-installing visual studio (make sure you delete the run-time's aswell). And install it again after having installed the directx sdk. Then use the settings I wrote up here and it will probably work (it does for me).

OTHER TIPS

I had same error and resolved it by linking with dinput8.lib and dxguid.lib. Interestingly I didn't had to include InitGuid.h.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top