Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I hope someone can help me, Im making a Windows forms project in c++ Im displaying 3d Graphics with OpenGL and i want to add a gamepad to control the program, But I cant find any help on using Xinput/direct input in windows forms in c++.

also I got an unmanaged code which im trying to compile with #Pragmaunmanaged but I get the following errors:

VB
>GamePadDInput.obj : error LNK2020: unresolved token (0A000039) IID_IDirectInputJoyConfig8
1>GamePadDInput.obj : error LNK2020: unresolved token (0A000050) IID_IDirectInput8W
1>GamePadDInput.obj : error LNK2001: unresolved external symbol _IID_IDirectInputJoyConfig8
1>GamePadDInput.obj : error LNK2001: unresolved external symbol _IID_IDirectInput8W
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_POV
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_Slider
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_RzAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_RyAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_RxAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_ZAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_YAxis
1>dinput8.lib(dilib4.obj) : error LNK2001: unresolved external symbol _GUID_XAxis
Posted

1 solution

My guess is you are using the latest DirectX SDK that was released in June 2010. The DirectInput libraries have been moved out of this version of the SDK. Your linker errors for dinput8.lib are because Microsoft has deprecated DirectInput and is pushing developers towards Raw input handling with WM_INPUT and XInput for use with the XBox controller.

I do not know how processing working with Windows Forms would affect any of this, but there are two decent article here on code project to help you get started with both of these forms of input:

XInput:
Xbox 360 Controller Input in C++ with XInput[^]

Raw Input API:
Using the Raw Input API to Process Joystick Input[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900