underdoeg / ofxGamepad

gamepad support for openframeworks 007
22 stars 14 forks source link

Compilation trouble under code::blocks #9

Open StudioAlbert opened 11 years ago

StudioAlbert commented 11 years ago

Hi, how is the behavior with code::blocks ? because I get those compilations troubles and I do not find something to link at specific to code::blocks.

obj\Release\addons\ofxGamePad\src\ofxGamepadHandler.o:ofxGamepadHandler.cpp|| undefined reference to OIS::InputManager::createInputSystem(std::multimap<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >&)'| obj\Release\addons\ofxGamePad\src\ofxGamepadHandler.o:ofxGamepadHandler.cpp|| undefined reference toOIS::InputManager::getNumberOfDevices(OIS::Type)'| obj\Release\addons\ofxGamePad\src\ofxGamepadHandler.o:ofxGamepadHandler.cpp|| undefined reference to OIS::InputManager::createInputObject(OIS::Type, bool, std::string const&)'| obj\Release\addons\ofxGamePad\src\ofxGamepadHandler.o:ofxGamepadHandler.cpp|| undefined reference toOIS::InputManager::destroyInputSystem(OIS::InputManager*)'| obj\Release\addons\ofxGamePad\src\ofxGamepadOIS.o:ofxGamepadOIS.cpp|| undefined reference to OIS::JoyStick::getNumberOfComponents(OIS::ComponentType) const'| obj\Release\addons\ofxGamePad\src\ofxGamepadOIS.o:ofxGamepadOIS.cpp|| undefined reference toOIS::JoyStick::getNumberOfComponents(OIS::ComponentType) const'| obj\Release\addons\ofxGamePad\src\ofxGamepadOIS.o:ofxGamepadOIS.cpp|| undefined reference to OIS::ForceFeedback::getSupportedEffects() const'| obj\Release\addons\ofxGamePad\src\ofxGamepadOIS.o:ofxGamepadOIS.cpp|| undefined reference toOIS::Effect::getEffectTypeName(OIS::Effect::EType)'| obj\Release\addons\ofxGamePad\src\ofxGamepadOIS.o:ofxGamepadOIS.cpp|| undefined reference to `OIS::InputManager::createInputObject(OIS::Type, bool, std::string const&)'| ||=== Build finished: 9 errors, 21 warnings (3 minutes, 58 seconds) ===|

gazpachu commented 10 years ago

I'm also having the same problem in Windows 7, CodeBlocks 12.11 with MinGW and OF v.0.8.0 :(

I've tried to link the VS2008/OIS_static.lib and also VS2010/OIS_vs2010_static.lib but it doesn't work

underdoeg commented 10 years ago

Hi. The problem is that the addon currently only has compiled OIS libraries for visual studio. Those won't work with Code::Blocks. You can try to compile OIS yourself by downloading it from here: http://sourceforge.net/projects/wgois/ from what I can see it has a codeblocks project file included in the zip.

I don't have a windows development environement atm so I can't do it. But I can try to help if you run into any problems...

gazpachu commented 10 years ago

That makes sense...

I've downloaded it and tried to compile it but it throw some errors:

||=== OIS, Release ===| ..\includes\win32\Win32ForceFeedback.h||In constructor 'OIS::Win32ForceFeedback::Win32ForceFeedback(IDirectInputDevice8A, const DIDEVCAPS)':| ..\includes\win32\Win32ForceFeedback.h|105|warning: 'OIS::Win32ForceFeedback::mFFAxes' will be initialized after [-Wreorder]| ..\includes\win32\Win32ForceFeedback.h|102|warning: 'const DIDEVCAPS* OIS::Win32ForceFeedback::mpDIJoyCaps' [-Wreorder]| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|39|warning: when initialized here [-Wreorder]| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'virtual short unsigned int OIS::Win32ForceFeedback::getFFMemoryLoad()':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|85|warning: comparison between signed and unsigned integer expressions [-Wsign-compare]| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'virtual void OIS::Win32ForceFeedback::setMasterGain(float)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|162|warning: unused variable 'hr' [-Wunused-variable]| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'virtual void OIS::Win32ForceFeedback::setAutoCenterMode(bool)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|185|warning: unused variable 'hr' [-Wunused-variable]| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'void OIS::Win32ForceFeedback::updateConstantEffect(const OIS::Effect)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|198|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|198|error: 'lX' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|198|error: 'offsetof' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|198|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|198|error: 'lY' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'void OIS::Win32ForceFeedback::updateRampEffect(const OIS::Effect)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|222|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|222|error: 'lX' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|222|error: 'offsetof' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|222|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|222|error: 'lY' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'void OIS::Win32ForceFeedback::updatePeriodicEffect(const OIS::Effect)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|241|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|241|error: 'lX' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|241|error: 'offsetof' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|241|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|241|error: 'lY' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'void OIS::Win32ForceFeedback::updateConditionalEffect(const OIS::Effect)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|271|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|271|error: 'lX' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|271|error: 'offsetof' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|271|error: expected primary-expression before ',' token| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|271|error: 'lY' was not declared in this scope| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp||In member function 'void OIS::Win32ForceFeedback::upload(GUID, DIEFFECT, const OIS::Effect_)':| C:\Users\jmira\Desktop\ois-v1-3\ois-v1-3\src\win32\Win32ForceFeedback.cpp|415|warning: comparison between signed and unsigned integer expressions [-Wsign-compare]| ||=== Build finished: 20 errors, 7 warnings (0 minutes, 7 seconds) ===|

underdoeg commented 10 years ago

dammit... :) But I just had an idea. afaik OIS is included with ogre. it is probably a part of this download. http://sourceforge.net/projects/ogre/files/ogre/1.8/1.8.1/OgreSDK_MinGW_v1-8-1.exe/download

gazpachu commented 10 years ago

We are getting close...

After downloading Ogre, I got the "libOIS.dll.a" file and placed it in the "lib folder of ofxGamepad.

Then I moved the "OIS.dll" file into the "data" folder of my app.

Then run the app and I got the following error:

lib error

I've downloaded the "libstdc++-6.dll" file from the Internet and placed it in the "data" folder.

Now the app runs but crashes right away if I use ofxGamepadHandler::get() in the setup method.

If I leave the setup method empty, the app runs okay.

Any idea?


void testApp::setup(){
    ofxGamepadHandler::get()->enableHotplug();
    //CHECK IF THERE EVEN IS A GAMEPAD CONNECTED
    if(ofxGamepadHandler::get()->getNumPads()>0){
            ofxGamepad* pad = ofxGamepadHandler::get()->getGamepad(0);
            ofAddListener(pad->onAxisChanged, this, &testApp::axisChanged);
            ofAddListener(pad->onButtonPressed, this, &testApp::buttonPressed);
            ofAddListener(pad->onButtonReleased, this, &testApp::buttonReleased);
    }
}