954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

playe class

hi I'm trying to create a player class for irrlicht

the main game file calls it like this

CPlayer cPlayer;
	player = cPlayer.Create();


the thing is that the function must return the player so the function must be scene::IAnimatedMeshSceneNode*.

player header

#ifndef __C_Player_H_INCLUDED__
#define __C_Player_H_INCLUDED__

#include <irrlicht.h>

using namespace irr;

#ifdef _IRR_WINDOWS_
#include <windows.h>
#endif

class CPlayer : public IEventReceiver
{
public:

	CPlayer();
	
	scene::IAnimatedMeshSceneNode* Create();

	virtual bool OnEvent(const SEvent& event);

private:

	
	IrrlichtDevice *device;
	scene::IAnimatedMeshSceneNode* player;
};


#endif


when i try to compile it
the linker says1>CGame.obj : error LNK2019: unresolved external symbol "public: class irr::scene::IAnimatedMeshSceneNode * __thiscall CPlayer::Create(void)" (?Create@CPlayer@@QAEPAVIAnimatedMeshSceneNode@scene@irr@@XZ) referenced in function "private: void __thiscall CGame::loadSceneData(void)" (?loadSceneData@CGame@@AAEXXZ)
1>CGame.obj : error LNK2019: unresolved external symbol "public: __thiscall CPlayer::CPlayer(void)" (??0CPlayer@@QAE@XZ) referenced in function "private: void __thiscall CGame::loadSceneData(void)" (?loadSceneData@CGame@@AAEXXZ)
1>.\Debug\iir sonic 2.exe : fatal error LNK1120: 2 unresolved externals

alex-VX
Light Poster
27 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

These errors say that the compiler cannot find the definition (implementation) of the class CPlayer. You must have forgotten to add the Player.cpp file to the compilation process (or its .o file, or the static library to which it was compiled).

mike_2000_17
Posting Virtuoso
Moderator
2,134 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: