Verweis auf nicht aufgelöstes externes Symbol
-
Hey.
Stehe grad irgendwie auf dem Schlauch.
Finde mein symbol nicht, welches nicht aufgelöst sein soll.AbtractGladiator.h
#ifndef _AbstractGladiator_h_ #define _AbstractGladiator_h_ #include "Armors\AbstractArmor.h" #include "Weappons\AbstractWeappon.h" #include "..\..\Helper\Math.h" typedef unsigned int UINT; enum GLADIATOR_TYPE { GLADIATOR_VERSUS, GLADIATOR_MAGNUS, GLADIATOR_PRISCUS, }; class CAbstractGladiator { protected: GLADIATOR_TYPE m_type; unsigned int m_iBody; //1,2,3 unsigned int m_iLevel; unsigned int m_iPg; //progressPoints unsigned int m_iCurProtection; unsigned int m_iMaxProtection; unsigned int m_iSpecialAbilityAmount; unsigned int m_iSpecialAbilityAmountInArena; //max ist 3 CAbstractArmor m_aArmor[4]; //max 4 aromor pices avilable CAbstractWeappon m_Weappons[9]; //max 9 weappon pices avilable public: CAbstractGladiator( GLADIATOR_TYPE type, UINT iBody, UINT iLevel, UINT iPg, UINT iCurProtection, UINT iMaxProtection, UINT iSpezialAbilityAmount, CAbstractArmor* pArmor[4], CAbstractWeappon* pWeappon[9]) { m_type = type; m_iBody = iBody; m_iLevel = iLevel; m_iPg = iPg; m_iCurProtection = iCurProtection; m_iMaxProtection = iMaxProtection; m_iSpecialAbilityAmount = iSpezialAbilityAmount; m_iSpecialAbilityAmountInArena = CMath::Clamp<unsigned int>(iSpezialAbilityAmount, 0, 3); for(int i = 0 ; i < 4 ; i++) { m_aArmor[i] = *pArmor[i]; } for(int i = 0 ; i < 9 ; i++) { m_Weappons[i] = *pWeappon[i]; } } virtual void SetGladiatorType(GLADIATOR_TYPE type) { m_type = type; } virtual GLADIATOR_TYPE GetGladiatorType() { return m_type; } virtual void SetGladiatorLevel(unsigned int iLevel) { m_iLevel = iLevel; } virtual unsigned int GetGladiatorLevel() { return m_iLevel; } virtual void SetGladiatorBody(unsigned int iBody) { m_iBody = iBody; } virtual unsigned int GetGladiatorBody() { return m_iBody; } virtual void SetGladiatorPg(unsigned int iPg) { m_iPg = iPg; } virtual unsigned int GetGladiatorPg() { return m_iPg; } virtual void SetGladiatorCurProtection(unsigned int iCurProtection) { m_iCurProtection = iCurProtection; } virtual unsigned int GetGladiatorCurProtection() { return m_iCurProtection; } virtual void SetGladiatorMaxProtection(unsigned int iMaxProtection) { m_iMaxProtection = iMaxProtection; } virtual unsigned int GtGladiatorMaxProtection() { return m_iMaxProtection; } virtual void SetGladiatorSpecialAbilityAmount(unsigned int iVal) { m_iSpecialAbilityAmount = iVal; } virtual unsigned int GetGladiatorSpecialAbilityAmount() { return m_iSpecialAbilityAmount; } virtual void SetGladiatorSpecialAbilityAmountInArena(unsigned int iVal) { m_iSpecialAbilityAmountInArena = iVal; } virtual unsigned int GetGladiatorSpecialAbilityAmountInArena() { return m_iSpecialAbilityAmountInArena; } }; #endif//_AbstractGladiator_h_Math.h
#ifndef _Math_h_ #define _Math_h_ class CMath { public: template<typename T> static T Clamp(T val, T min, T max); }; #endif//_Math_h_Math.cpp
#include "Math.h" template<typename T> T CMath::Clamp(T val, T min, T max) { if(val < min) return min; if(val > max) return max; return val; }Fehlermeldung
Fehler 1 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: static unsigned int __cdecl CMath::Clamp<unsigned int>(unsigned int,unsigned int,unsigned int)" (??$Clamp@I@CMath@@SAIIII@Z)" in Funktion ""public: __thiscall CAbstractGladiator::CAbstractGladiator(enum GLADIATOR_TYPE,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,class CAbstractArmor * * const,class CAbstractWeappon * * const)" (??0CAbstractGladiator@@QAE@W4GLADIATOR_TYPE@@IIIIIIQAPAVCAbstractArmor@@QAPAVCAbstractWeappon@@@Z)". Main.objIch bin mir sicher, dass es nur ne Kleinigkeit ist, aber irgendwie schaffe ich es gerade nicht den Fehler zu finden.
mfg Darter
-
Schau mal unter Haufig gestellte Fragen bei Punkt 5.
-
Hey, ich gehe davon aus, du meinst Punkt 5
Ok, habs mir durchgelesen, und ich war mir eig. ziehmlich sicher, dass templates auch in der cpp definieren könnte, habe ich mich wohl getäuscht. Da ich aber selten templates verwende, sei mir der Fehler hoffentlich verziehen.
Also schnell die definition direkt in die Klasse gepackt, jedoch still the same.
Edit: dein Edit erst jetzt gesehen, habe ja aber gefunden was du meinst

-
Darter schrieb:
Also schnell die definition direkt in die Klasse gepackt, jedoch still the same.
Dann liefere uns mal ein compilierbares minimales Beispiel, das den Fehler reproduzierbar macht.