Bonjoir !
Je rencontre un problème avec mes spécialisations de templates, sous Gcc mais pas sous Visual Studio.
Comme un bout de code est plus parlant...
Dans Factory.hpp j'ai ceci :
	
	| 12
 3
 4
 5
 6
 7
 8
 9
 10
 
 |    template <class Obj, class Key=String>
   class Factory
   {
   private:
      typedef shared_ptr<Obj> obj_ptr;
      typedef std::map<Key, obj_ptr> obj_map;
      static obj_map m_mapRegistered;
   public:
      // des fonctions qui vont bien
   }; | 
 Dans Light.cpp j'ai ceci :
	
	Factory<LightCategory, eLIGHT_TYPE>::obj_map Factory<LightCategory, eLIGHT_TYPE>::m_mapRegistered;
 Si j'essaie de compiler comme ça il me sort comme erreur:
	
	error: specializing member 'Factory<LightCategory, eLIGHT_TYPE>::m_mapRegistered' requires 'template<>' syntax
 Je me dis "Ok, on va faire ce qu'il demande" :
	
	template <> Factory<LightCategory, eLIGHT_TYPE>::obj_map Factory<LightCategory, eLIGHT_TYPE>::m_mapRegistered;
 Et là il me met l'erreur de link suivante :
	
	référence indéfinie vers Factory<LightCategory, eLIGHT_TYPE>::m_mapRegistered
 ???
Qu'est-ce que j'ai fait de mal ? (au cas où la question vous viendrait à l'esprit, le fichier Light.cpp est bel et bien inclus dans le projet).
Je reprécise que ces erreurs arrivent uniquement sous gcc et pas sous VisualStudio.
						
					
Partager