Bonjour,

j'ai un petit probleme du a un passage de gcc3.2.3 a un gcc plus recent.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 
HPP FILE :
 
template <typename _EnumType, unsigned int _enumCount>
class myTopClass
{
    public:
        inline static const std::string &GetClassName  (                       ) { return CLASS_NAME;       }
        inline static const std::string &GetName       (_EnumType id           ) { return Names[id];        }
        inline static unsigned int       GetDefaultSize(_EnumType id           ) { return DefaultSizes[id]; }
        inline static _EnumType          GetId         (const std::string &name);
        template <class _FinalType>
         static void InitializeArray(_FinalType  array[]);
        template <class _FinalType>
         static void InitializeArray(_FinalType* array[]);
 
        inline myTopClass() {}
        inline virtual ~myTopClass() {}
        inline myTopClass(_EnumType id) { setId(id); }
        inline _EnumType          id  () const { return m_id         ; }
        inline const std::string &name() const { return GetName(id()); }
        inline unsigned int       size() const { return m_size       ; }
        inline void setSize(unsigned int size) { m_size = size       ; }
 
    protected:
        static void Define(_EnumType id, const std::string &name, unsigned int defaultSize);
 
        inline void setId(_EnumType id) { m_id = id; setSize(GetDefaultSize(id)); }
 
        static const std::string                CLASS_NAME;
        static std::map<std::string, _EnumType> EnumFromName;
        static std::string                      Names[_enumCount];
        static unsigned int                     DefaultSizes[_enumCount];
 
        // protected attributes
        _EnumType    m_id;
        unsigned int m_size;
};
......
class botClassA: public myTopClass<Register, REGISTER_COUNT>
{
    public:
               static void         Initialize();
        inline static unsigned int GetAddress(Register reg) { return Addresses[reg]; }
 
        inline botClassA() {}
               virtual ~botClassA();
        inline botClassA(Register reg) : myTopClass<Register, REGISTER_COUNT>(reg) {}
        inline unsigned int address() const { return GetAddress(id()); } ///< instance accessor for convenience
 
    protected:
        static unsigned int Addresses[REGISTER_COUNT];
};
 
class botClassB: public myTopClass<CtrlCField, CCFIELD_COUNT>
{
    public:
        static void Initialize();
        static void ComputeLsbsInArray(botClassB array[]);
 
	//inline botClassB() {}
	virtual ~botClassB();
        inline unsigned int lsb() const { return m_lsb; }
 
    protected:
        inline unsigned int &lsb() { return m_lsb; } ///< write access is protected ; only ComputeLsbsInArray() can set it
 
        unsigned int m_lsb;
};
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
CPP FILE : 
// botClassA class attributes
/*work for GCC 3.2.3
unsigned int botClassA::Addresses[REGISTER_COUNT];*/
template<> unsigned int botClassA::Addresses[REGISTER_COUNT];
 
// botClassA class attributes (inherited from topClass template)
/*work for GCC 3.2.3
const std::string                  myTopClass<Register, REGISTER_COUNT>::CLASS_NAME("botClassA");
std::map<std::string, Register> myTopClass<Register, REGISTER_COUNT>::EnumFromName;
std::string                        myTopClass<Register, REGISTER_COUNT>::Names[REGISTER_COUNT];
unsigned int                       myTopClass<Register, REGISTER_COUNT>::DefaultSizes[REGISTER_COUNT];*/
template<> 		const std::string                  myTopClass<Register, REGISTER_COUNT>::CLASS_NAME("botClassA");
template<> 		std::map<std::string, Register> myTopClass<Register, REGISTER_COUNT>::EnumFromName;
template<> 		std::string                        myTopClass<Register, REGISTER_COUNT>::Names[REGISTER_COUNT];
template<> 		unsigned int                       myTopClass<Register, REGISTER_COUNT>::DefaultSizes[REGISTER_COUNT];
 
 
 
// botClassB class attributes (inherited from topClass template)
/*work for GCC 3.2.3
const std::string                   myTopClass<CtrlCField, CCFIELD_COUNT>::CLASS_NAME("botClassB");
std::map<std::string, CtrlCField> myTopClass<CtrlCField, CCFIELD_COUNT>::EnumFromName;
std::string                         myTopClass<CtrlCField, CCFIELD_COUNT>::Names[CCFIELD_COUNT];
unsigned int                        myTopClass<CtrlCField, CCFIELD_COUNT>::DefaultSizes[CCFIELD_COUNT];*/
template<> 		const std::string                   myTopClass<CtrlCField, CCFIELD_COUNT>::CLASS_NAME("botClassB");
template<> 		std::map<std::string, CtrlCField> myTopClass<CtrlCField, CCFIELD_COUNT>::EnumFromName;
template<> 		std::string                         myTopClass<CtrlCField, CCFIELD_COUNT>::Names[CCFIELD_COUNT];
template<>  		unsigned int                        myTopClass<CtrlCField, CCFIELD_COUNT>::DefaultSizes[CCFIELD_COUNT];
Avec le gcc3.2.3 aucun probleme de compilation et d'execution du program.
Avec gcc3.4.6, probleme a la compilation "error : too few template-parameter-lists problem sur les lignes identifiees dans le code ci dessus.
J'ai donc ajoute "template<>" en debut de chaque ligne, ce qui m'a permis d'avoir une compilation OK
Code pour GCC3.2.3 commente et remplace par le code pour le GCC3.4.6
Malheureusement, au chargement du program j'ai l'erreur ci apres :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
ERROR:TestExec: Can not load the library XXX.so (XXX.so: undefined symbol: _ZN12myTopClassI12CtrlCFieldLj15EE12DefaultSizesE)
J'ai beau chercher mais je ne comprends pas ce qui peut poser un probleme ici.

Si une bonne ame pouvait se pencher sur ce probleme, cela me serait d'une grande utilite.
Merci