   Linker problems
  HiI'm trying to make a baseclass and one class derived from it. The baseclass is called cBase_Entity, and this is what Base_Entityclass.h looks like:#ifndef BASE_ENTITYCLASS_H#define BASE_ENTITYCLASS_H#include <string>#include <Ogre.h>#include <vector>class cBase_Entity{public:cBase_Entity( );virtual ~cBase_Entity();Ogre::Vector3 GetEntityPosition( );void SetEntityPosition( Ogre::Vector3 NewPosition );void UpdateEntity( Ogre::Real ElapsedTime );protected:std::string EntityName;bool EntityIsActive;Ogre::AnimationState* mEntityAnimState;Ogre::Real mEntityAnimationSpeed;Ogre::SceneNode *EntityOgreNode;Ogre::Entity *OgreEntity;};#endifThe derived class is called cWorker and this is what Workerclass.h looks like:#ifndef WORKERCLASS_H#define WORKERCLASS_H#include <string>#include <Ogre.h>#include <vector>#include "Base_Entityclass.h"class cWorker:public cBase_Entity{public:cWorker( std::string Name, Ogre::SceneManager *SceneMgr );private:};#endifWorkerclass.cpp looks like this:#include "Workerclass.h"cWorker::cWorker(std::string Name, Ogre::SceneManager *SceneMgr){OgreEntity = SceneMgr->createEntity( "OgreEntity_Worker_" + Name, "animationmodel.mesh" );Ogre::SceneNode *EntityOgreNode = SceneMgr->getRootSceneNode()->createChildSceneNode( "OgreNode_Worker_" + Name);EntityOgreNode->attachObject( OgreEntity );EntityOgreNode->setPosition(Ogre::Vector3(0, 6, -50));mEntityAnimState = OgreEntity->getAnimationState("Action");    mEntityAnimState->setEnabled(true);mEntityAnimState->setLoop(false);    mEntityAnimationSpeed = 4.0;}void cWorker::UpdateEntity(Ogre::Real ElapsedTime){static Ogre::Real inc = 0; inc += ElapsedTime * mEntityAnimationSpeed; mEntityAnimState->setTimePosition(inc);}When I try to compile it gives me the following error:Quote:1>Workerclass.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall cBase_Entity::~cBase_Entity(void)" (??1cBase_Entity@@UAE@XZ)1>Workerclass.obj : error LNK2001: unresolved external symbol "public: __thiscall cBase_Entity::cBase_Entity(void)" (??0cBase_Entity@@QAE@XZ)1>..\bin\Release\Baseclass_Animation.exe : fatal error LNK1120: 2 unresolved externalsI've tried reading this and feel like my problem is like the fourth one in the article. It says I should use extern to solve the problem. Being a selftaught newbie I really don't know how and what to extern. Can anyone help me?   
  Have you implemented cBase_Entity::cBase_Entity abd cBase_Entity::~cBase_Entity?Post Base_Entityclass.cpp.   ;Quote:Original post by NorthernlightCan anyone help me?<harsh>I guess you should start with an elementary school course about reading.</harsh>The article you mentioned discusses the following error:Quote:"error LNK2005: "int myGlobal" (?myGlobal@@3HA) already defined in myotherfile.obj"Your error, on the other hand, is:Quote:error LNK2001: unresolved external symbol "public: __thiscall cBase_Entity::cBase_Entity(void)" (??0cBase_Entity@@QAE@XZ)There are several differences. For instance, your error contains 'LNK2001' whereas the article mentions error 'LNK2005'. There's also the fact that your error means an external symbol is unresolved (whatever that means) while the article considers something being already defined (whatever that means).In short, the article discusses a problem which is obviously different from yours.The documentation for that error message (found when googling for "msdn2 lnk2005", msdn2 being the prefix for the Microsoft documentation website) explains a list of possible causes.Given the looks of your code, I would believe that you've forgotten to define the constructor and destructor of your cBase_Entity class.Bonus points for providing the source code and exact error messages in your post, though.;  Thanks for answering guys.Quote:There are several differences. For instance, your error contains 'LNK2001' whereas the article mentions error 'LNK2005'.Yes, I noticed that :) In my defence the article was referred to in another similar post about LNK2001 problems. Quote:Have you implemented cBase_Entity::cBase_Entity abd cBase_Entity::~cBase_Entity?Quote:Given the looks of your code, I would believe that you've forgotten to define the constructor and destructor of your cBase_Entity class....and this is where my newbieness shines through :) I have not implemented cBase_Entity::cBase_Entity and cBase_Entity::~cBase_Entity :( There actually is no Base_Entityclass.cpp. I've written a good deal of classes (and C++ code in general), but I've yet to use inheritance fully in my code. Guess it didn't strike me that the functions had to be defined, even though the class is meant to be a base class.I was following a book example on AI code and used one of its examples on a derived class. I guess I missed the implementation of the functions of the base class.Well, I guess I have learned a lesson today :) The code will probably work fine after I implement a Base_Entityclass.cpp.Thanks for your help guys!   