CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Sep 2008
    Posts
    70

    [RESOLVED] Linker Error

    Hello all, i would appreciate it if anyone could enlighten me on a linker error.

    First off the error
    Code:
    Error	1	error LNK2019: unresolved external symbol "public: __thiscall ReachTop<class Character>::ReachTop<class Character>(class Character *)" (??0?$ReachTop@VCharacter@@@@QAE@PAVCharacter@@@Z) referenced in function "void __cdecl `dynamic initializer for 'gReachTop''(void)" (??__EgReachTop@@YAXXZ)	Main.obj	DecisionTest

    Reach Top class inherits from Goal Class

    Goal Class
    Code:
    #ifndef _GOAL_H
    #define _GOAL_H
    
    #include "Action.h"
    #include <list>
    
    template <class T>
    class Goal
    {
    public:
    	Goal(T* pOwner) : mpOwner(pOwner) {}
    	virtual ~Goal() {}
    	
    	virtual float CalculateDesirability() = 0;
    	virtual Action<T>* CreateAction() = 0;
    
    protected:
    	T* mpOwner;
    };
    
    template <class T>
    struct GoalList
    {
    	typedef std::list<Goal<T>*> Type;
    };
    
    #endif
    ReachTop Class Header
    Code:
    #ifndef _REACHTOP_H
    #define _REACHTOP_H
    
    #include <AI.h>
    #include <SGE.h>
    
    using namespace SGE;
    
    template <typename T>
    class ReachTop : public Goal<T>
    {
    public:
    	ReachTop<T>(T* pOwner);
    	virtual ~ReachTop() {}
    	
    	virtual float CalculateDesirability();
    	virtual Action<T>* CreateAction();
    
    protected:
    	T* mpOwner;
    };
    
    
    #endif
    Reachtop class cpp
    Code:
    #include "ReachTop.h"
    
    
    template <typename T>
    ReachTop<T>::ReachTop(T* pOwner) 
    : mpOwner(pOwner)
    {
    
    }
    
    template <typename T>
    float ReachTop<T>::CalculateDesirability()
    {
    
    }
    
    template <typename T>
    Action<T>* ReachTop<T>::CreateAction()
    {
    
    }
    Code to create
    Code:
    Character* gCharacter = new Character(1, gWorld);
    Goal<Character>* gReachTop = new ReachTop<Character>(gCharacter);
    Any ideas? I can provide the character class and its inheritance aswell if you like.
    Last edited by marsh; December 10th, 2012 at 02:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured