[Solved]OgreBites::InputListener give unresolved external symbols Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
Bady
Halfling
Posts: 52
Joined: Sun Mar 16, 2014 1:47 am
x 3

[Solved]OgreBites::InputListener give unresolved external symbols

Post by Bady »

Ogre Version: 13.2.4 (64 bit)
Operating System: window 10
Render System: DirectX 9,DirectX 11

Hi.

I decided to upgrade my project to the latest version of Ogre(from 1.10). So far everything works fine, exept one thing: I read on this forum, OIS is a dead end (and I can't build it for x64 for some reason) I decided to rewrite my control system with Ogrebites.
When I add the "public OgreBites::InputListener" to the class , I get a lot of unresolved external symbol error messages
I followed this tutorial for first:
https://ogrecave.github.io/ogre/api/latest/setup.html
then I searched up and down the whole internet, also tried to figure out from the samples, but soo far, no success.

I use a separated class for this purpose called "controlroom":

Controlroom.h

Code: Select all


#include <cmath>
#include<iostream>
#include <Ogre.h>
//#include <OISEvents.h>
//#include <OISInputManager.h>
//#include <OISKeyboard.h>
//#include <OISMouse.h>
#include "Bluedata.h"
#include <boost/bind.hpp>
#include "Raycast.h"
//#include <OgreBitesPrerequisites.h>//uncomenting this won't change the result
//#include <OgreInput.h>//uncomenting this won't change the result
#include <OgreApplicationContext.h>

class Controlroom : public OgreBites::ApplicationContext, public OgreBites::InputListener
{
private:
public:
	Controlroom() ; 
	~Controlroom();
	
	virtual bool keyPressed( const OgreBites::KeyboardEvent& evt );
	virtual bool keyReleased( const OgreBites::KeyboardEvent& evt );

       virtual bool mouseMoved(const OgreBites::MouseMotionEvent& evt );
       virtual bool mouseWheelRolled(const OgreBites::MouseWheelEvent& evt);
       virtual bool mousePressed( const OgreBites::MouseButtonEvent& evt);
       virtual bool mouseReleased( const OgreBites::MouseButtonEvent& evt);
	
};
Controlroom.cpp

Code: Select all

Controlroom::Controlroom():mShutDown(false) , OgreBites::ApplicationContext("OgreTutorialApp")
{
	 OgreBites::ApplicationContext::setup();
    	// register for input events
    	addInputListener(this);
}
Controlroom::~Controlroom()
{
}

bool Controlroom:: keyPressed( const OgreBites::KeyboardEvent& evt )
{
	int k = evt.keysym.sym;
}
bool Controlroom::keyReleased( const OgreBites::KeyboardEvent& evt )
{
	int k = evt.keysym.sym;
}

bool Controlroom::mouseMoved(const OgreBites::MouseMotionEvent& evt )
{
	if (!ismousexlocked) exmousex = evt.x;
	if (!ismouseylocked) exmousey = evt.y;
 }
bool Controlroom::mouseWheelRolled(const OgreBites::MouseWheelEvent& evt)
{
	wheelval = evt.y / 120;
}
bool Controlroom::mousePressed( const OgreBites::MouseButtonEvent& evt)
{
       	rawmousecode = evt.button;
}
bool Controlroom::mouseReleased( const OgreBites::MouseButtonEvent& evt)
 {
       	rawmousecode = evt.button;
}
Some error message(I will post all if necesary, but I think it's suffice enough to see what is the problem):

Code: Select all

Severity	Code	Description	Path	File	Line	Suppression State
Error	LNK2001	unresolved external symbol "__declspec(dllimport) public: __cdecl OgreBites::ApplicationContextSDL::ApplicationContextSDL(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0ApplicationContextSDL@OgreBites@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

Severity	Code	Description	Path	File	Line	Suppression State
Error	LNK2001	unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl OgreBites::ApplicationContextBase::setup(void)" (__imp_?setup@ApplicationContextBase@OgreBites@@UEAAXXZ

Severity	Code	Description	Path	File	Line	Suppression State
Error	LNK2001	unresolved external symbol "__declspec(dllimport) public: virtual bool __cdecl OgreBites::ApplicationContextBase::frameRenderingQueued(struct Ogre::FrameEvent const &)" (__imp_?frameRenderingQueued@ApplicationContextBase@OgreBites@@UEAA_NAEBUFrameEvent@Ogre@@@Z)	
I removed all not related codes(there are 2k lines there, it would be a nightmare to go trough on that text of wall and probably not related to the problem) If something missing, or not clear enough, I will complete it.


Interestingly everything else works fine, and (I think) I linked all the necessary resources.
Edit:
If I write "OgreBites::MouseButtonEvent" or "public OgreBites::MouseMotionEvent" there, it not give me the unresolved error.
Last edited by Bady on Wed Jan 19, 2022 11:28 pm, edited 1 time in total.
The last sceneblender
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: OgreBites::InputListener give unresolved external symbols

Post by sercero »

I'm still using OIS, latest version 1.5.1

The project is here https://github.com/wgois/OIS and it works in 64-bits.

But if you want to use OgreBites, make sure that you are linking against 'OgreBites'.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: OgreBites::InputListener give unresolved external symbols

Post by paroj »

also, if you dont use CMake, pay attention that all defines are correct, as we do some mumbo-jumbo for backwards compatibility:
https://github.com/OGRECave/ogre/blob/f ... text.h#L77
Bady
Halfling
Posts: 52
Joined: Sun Mar 16, 2014 1:47 am
x 3

Re: OgreBites::InputListener give unresolved external symbols

Post by Bady »

sercero wrote: Wed Jan 19, 2022 4:01 am I'm still using OIS, latest version 1.5.1

The project is here https://github.com/wgois/OIS and it works in 64-bits.
If is this still avaialble, I will live with it. Ogrebites sound nice, but I don't want to messing with my old system, OIS worked me just fine.
Thank you.
paroj wrote: Wed Jan 19, 2022 12:46 pm also, if you dont use CMake, pay attention that all defines are correct, as we do some mumbo-jumbo for backwards compatibility:
https://github.com/OGRECave/ogre/blob/f ... text.h#L77
I use CMake for it. I forgot to mention, I use Visual Studio 2017 for my project.

the other thing I totally forgot about, is a strange bug in the "Ogrebites.h".

I got this error messages from it when I link the "OgreApplicationContext.h":

Code: Select all

Severity	Code	Description	Path	File	Line	Suppression State
Error	C2059	syntax error: '(' components\bites\include\ogreinput.h	161

Severity	Code	Description	Path	File	Line	Suppression State
Error	C3805	'(': unexpected token, expected either '}' or a ','	components\bites\include\ogreinput.h	161

Severity	Code	Description	Path	File	Line	Suppression State
Error	C2143	syntax error: missing ')' before ';'	components\bites\include\ogreinput.h	166	
In ogreinput.h this lines marked as "expected an identifier" error for some reason(161 - 164 lines):

Code: Select all

 KMOD_ALT = 0x0100 | 0x0200,
 KMOD_CTRL = 0x0040 | 0x0080,
 KMOD_GUI = 0x0400 | 0x0800,
 KMOD_SHIFT = 0x0001 | 0x0002,
The reason I forgot about it, when I first saw this errors, I checked out, and modified a little bit to figure out what's going on, then I got disrupted sorly after, then I forgot change it back(I didn't wanted to leave like that) :oops: .

Edit:
I am not 100% but maybe this forgetfulness cause the unresolved problem.
Should I make a new topic for this?
I am wery confused right now.
The last sceneblender
Bady
Halfling
Posts: 52
Joined: Sun Mar 16, 2014 1:47 am
x 3

Re: OgreBites::InputListener give unresolved external symbols

Post by Bady »

Oh, never mind, That is a different problem.
I just needed to give the lib file direcly in the Linker options "additional dependencies" field.

I consider this problem solved. Ois is back on the menu. Thanks sercero.
The last sceneblender
Post Reply