xbox 360 控制器功能的链接器错误

Linker error with a xbox 360 controller function

本文关键字:链接 错误 功能 控制器 xbox      更新时间:2023-10-16

我得到了一个未定义的XInputGetState引用,我不知道为什么。我使用的标题是:XInput.hWindows.h

FIRSTPLAYER只是不断0.

XINPUT_STATE state;
ZeroMemory( &state, sizeof(XINPUT_STATE) );
// Simply get the state of the controller from XInput.
dwResult = XInputGetState( FIRSTPLAYER, &state );

任何建议都会很好。

我正在使用CodeBlocks IDE和MinGW作为编译器。

好的,我想通了。缺少这一行:

#pragma comment(lib, "XInput.lib") 

有没有更好的解决方法?我觉得这很奇怪!