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 says

1>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

Edited 6 Years Ago by alex-VX: bad name

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).

This article has been dead for over six months. Start a new discussion instead.