Cocos2d-x Linker issue with GameController

Hello dear Cocos2d developpers,

I am trying to test Cocos2D-x behaviour with controller, with version 3.7.1. Therefore I got all content from the default controller test in cocos2d-x-3.7.1\tests\game-controller-test\Classes that I included into a new project.

So I copied GameControllerTest.cpp and GameControllerTest.h.

Problem is that when I try to compile the whole project, I have some error from the GameControllerTest.cpp

Erreur 7 error LNK1120: 4 externes non résolus

C:\Projets\CocosTest2\MyGame\proj.win32\Debug.win32\MyGame.exe MyGame
Erreur 6 error LNK2019: symbole externe non résolu “public: static class cocos2d::EventListenerController * __cdecl cocos2d::EventListenerController::create(void)” (?create@EventListenerController@cocos2d@@SAPAV12@XZ) référencé dans la fonction “private: void __thiscall GameControllerTest::registerControllerListener(void)” (?registerControllerListener@GameControllerTest@@AAEXXZ) C:\Projets\CocosTest2\MyGame\proj.win32\GameControllerTest.obj MyGame
Erreur 3 error LNK2019: symbole externe non résolu “public: static void __cdecl cocos2d::Controller::startDiscoveryController(void)” (?startDiscoveryController@Controller@cocos2d@@SAXXZ) référencé dans la fonction “private: void __thiscall GameControllerTest::registerControllerListener(void)” (?registerControllerListener@GameControllerTest@@AAEXXZ) C:\Projets\CocosTest2\MyGame\proj.win32\GameControllerTest.obj MyGame
Erreur 4 error LNK2019: symbole externe non résolu “public: static void __cdecl cocos2d::Controller::stopDiscoveryController(void)” (?stopDiscoveryController@Controller@cocos2d@@SAXXZ) référencé dans la fonction “public: virtual __thiscall GameControllerTest::~GameControllerTest(void)” (??1GameControllerTest@@UAE@XZ) C:\Projets\CocosTest2\MyGame\proj.win32\GameControllerTest.obj MyGame

Those are non resolved external symbols, when the code call functions from the controller’s library. Therefore I assume that this is a missing include. But as I’m not yet very familiar with cocos, I can’t really figure which one.

Has someone an idea of what is missing ? Thanks by advance :wink:

The same happens to me. I’m using version 3.8.1 with Windows 10 and Visual Studio Community 2015. Did you have any success with this?

I need help on this too

Actually, it’s simple: Cocos2d-x doesn’t support game controllers for desktop platforms. There are a lot of alternative solutions however: SDL, Gainput, Sheado’s modification of v3.0 among others.

Take a look here: Gamepad / Controller Support - OSX / PC / Mobile