[solved] problem with OIS

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
Murderface
Gnoblar
Posts: 8
Joined: Mon Feb 13, 2012 1:23 am

[solved] problem with OIS

Post by Murderface »

Hi,
I have an header file :

Code: Select all

#ifndef OIS_FRAMEWORK_HPP
#define OIS_FRAMEWORK_HPP
#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>

class OISFramework : public OIS::KeyListener, public OIS::MouseListener
{
public:
	OISFramework();
	~OISFramework();
	bool keyPressed( const OIS::KeyEvent &arg );
	bool keyReleased( const OIS::KeyEvent &arg ) ;
	bool mouseMoved( const OIS::MouseEvent &arg );
	bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
	bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
};

#endif
a cpp file :

Code: Select all

#include "headers/OISFramework.hpp"



OISFramework::OISFramework()
{
//
}

When I compil, I got this error :

Code: Select all

Linking CXX executable dist/bin/App
CMakeFiles/App.dir/OISFramework.cpp.o: In function `OISFramework':
/home/user/version/1201/OISFramework.cpp:3: undefined reference to `vtable for OISFramework'
/home/user/version/1201/OISFramework.cpp:3: undefined reference to `vtable for OISFramework'
collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [dist/bin/App] Erreur 1
make[1]: *** [CMakeFiles/App.dir/all] Erreur 2
make: *** [all] Erreur 2
I got this error only with the constructor, with any other bool function I haven't any problem, moreover if I put the implementation in the header file where I declared the constructor I haven't this error.

I really don't understand why, so I thought since almost all Ogre users are using OIS, maybe you can help me.
Last edited by Murderface on Fri Mar 09, 2012 12:17 am, edited 1 time in total.
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12
Contact:

Re: problem with OIS

Post by mmixLinus »

Hi

Got it working?

I don't KNOW what's causing the problem you're seeing, but I notice:
1) You haven't defined a destructor. You could try ~OISFramework() { }
2) OIS::KeyListener is pure virtual according to a tutorial so you MUST declare the missing methods on your cpp file.
3) Same for OIS::MouseListener. (maybe you've only copied a small piece of your cpp file)

Good Luck! /mmixLinus
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
Murderface
Gnoblar
Posts: 8
Joined: Mon Feb 13, 2012 1:23 am

Re: problem with OIS

Post by Murderface »

for now, I can't work anymore on, I have several exams durings the two next weeks, but I'll need to make it works, for severals projects.
I'll be back in two weeks.

Anyway big thx, your answer give to me a new direction to explore

I found a little weird to see that OIS haven't any tutorial and coming to Ogre3D for getting some helps...
Murderface
Gnoblar
Posts: 8
Joined: Mon Feb 13, 2012 1:23 am

Re: problem with OIS

Post by Murderface »

hi folks!
mmixLinus you right, I didn't noticed that some methods are pure virtual, I am not accustomed to using pure virtuals methods... I learned C++ only 6 months ago...

so anyway, thank you my problem is solved.... In few weeks I should implement Ogre3D to my engine... so I'll see you guys 'later'...
Post Reply