Link Error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
teckygamer
Posts: 9
Joined: Wed Jul 28, 2010 8:12 pm

Link Error

Post by teckygamer »

Hi, have come across these link errors, but an not sure what they mean :? , tried troubleshooting but have drawn blank. Any help would be appreciated, thannk you

Error 4 error LNK2019: unresolved external symbol "public: virtual __thiscall CStateT<class CGame,struct irr::SEvent>::~CStateT<class CGame,struct irr::SEvent>(void)" (??1?$CStateT@VCGame@@USEvent@irr@@@@UAE@XZ) referenced in function __unwindfunclet$??0CGlobalState@@QAE@XZ$0 CGlobalState.obj

Error 5 error LNK2001: unresolved external symbol "public: virtual __thiscall CStateT<class CGame,struct irr::SEvent>::~CStateT<class CGame,struct irr::SEvent>(void)" (??1?$CStateT@VCGame@@USEvent@irr@@@@UAE@XZ) COptionState.obj
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

you defined a destructor for your CStateT, but didnt implement it.
Image
Image
teckygamer
Posts: 9
Joined: Wed Jul 28, 2010 8:12 pm

Post by teckygamer »

Ty
teckygamer
Posts: 9
Joined: Wed Jul 28, 2010 8:12 pm

Post by teckygamer »

These classes throw an error because they have own destructor
in use

Code: Select all

class CPausedState : public CStateT<CGame, SEvent>
{
public:
	////!
	CPausedState():;

	//!//!
	virtual ~CPausedState(); // Having this invokes the link error removing it helps
Have i unknowingly created duplicates. Should i put the classes with this error into the same cpp file.?
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

if you dont use the destructor of CPausedState, so the CStateT's destructor is enough, then remove the declaration. else, implement it
Image
Image
teckygamer
Posts: 9
Joined: Wed Jul 28, 2010 8:12 pm

Post by teckygamer »

I figured out a fix which was to implement the destructor within the cpp file, however now i get this from the main.

Error 2 error LNK2019: unresolved external symbol "public: virtual __thiscall CStateGraphT<class CGame,struct irr::SEvent>::~CStateGraphT<class CGame,struct irr::SEvent>(void)" (??1?$CStateGraphT@VCGame@@USEvent@irr@@@@UAE@XZ) referenced in function __unwindfunclet$??0CGame@@QAE@PAVIrrlichtDevice@irr@@@Z$0 main.obj

Error 3 error LNK2019: unresolved external symbol "public: virtual __thiscall CStateT<class CGame,struct irr::SEvent>::~CStateT<class CGame,struct irr::SEvent>(void)" (??1?$CStateT@VCGame@@USEvent@irr@@@@UAE@XZ) referenced in function __unwindfunclet$??0CGlobalState@@QAE@XZ$0 main.obj

What does function _unwindfunclet$ mean?

This is CGame

Code: Select all

#ifndef _C_Game_H_
#define _C_Game_H_

#include <irrlicht.h>

#include "CStateT.h"
#include "CStateGraphT.h"

using namespace irr;
using namespace video;
using namespace scene;
using namespace gui;
using namespace core;

class CGame	: public IEventReceiver	, public CStateGraphT<CGame, SEvent>
{
public:
	//!
	CGame(IrrlichtDevice* device): CStateGraphT<CGame, SEvent>(this), Device(device)
	{
		Device->grab();
		Device->setEventReceiver(this);
	}

	//!
	virtual ~CGame()
	{
		Device->setEventReceiver(0);
		Device->drop();
	}

	//! call through methods
	ISceneManager* getSceneManager() const{
		return Device->getSceneManager();
	}

	gui::IGUIEnvironment* getUserInterface() const
	{
		return Device->getGUIEnvironment();
	}

	video::IVideoDriver* getVideoDriver() const
	{
		return Device->getVideoDriver();
	}

	ITimer* getTimer() const
	{
		return Device->getTimer();
	}

	void setDevice(IrrlichtDevice* device)
	{
		if (Device) {
			Device->setEventReceiver(0);
			Device->drop();
		}

		Device = device;

		if (Device) {
			Device->grab();
			Device->setEventReceiver(this);
		}
	}

	IrrlichtDevice* getDevice()
	{
		return Device;
	}

	bool run()
	{
		return Device->run();
	}

	//!
	CStateT<CGame, SEvent>* findGameState(const char* name)
	{
		s32 f = States.binary_search(SState(name));
		if (f != -1)
			return States[f].State;

		return 0;
	}

	//!
	void addGameState(const char* name, CStateT<CGame, SEvent>* state)
	{
		States.push_back(SState(name, state));
	}

	//! adapt from irrlicht event handling to ours
	  virtual bool OnEvent(const SEvent& event)
	{
		return onEvent(event);
	}

private:
	IrrlichtDevice* Device;

	struct SState
	{
		SState(const c8* name = 0, CStateT<CGame, SEvent>* state = 0)
			: Name(name)
			, State(state)
		{
		}

		bool operator<(const SState& other) const
		{
			return strcmp(Name, other.Name) < 0;
		}

		const c8* Name;
		CStateT<CGame, SEvent>* State;
	};

	core::array<SState> States;
};

#endif

Post Reply