E
Edoardo Tagome
Hi,
first of all I must apologize if I'm OT (and I fear I may be) but I
couldn't find a better NG (at least among the ones I have access to).
I can build this code in Visual Studio 2010 but g++ (android-ndk-r8d)
fails to build.
As you can see the problem has to do woth friendship and inheritance
B<T>
^
|
|
F<T>
^
|
|
A
---- MaGoTest.hpp BEGIN ----
template <class T>
class MaGoTestB
{
private:
T *mVar ;
public:
void M2( void ) ;
} ;
template <class T>
class MaGoTestF : public MaGoTestB< T >
{
private:
T *mVar ;
public:
void M3( void ) ;
} ;
class MaGoTestA : public MaGoTestF< MaGoTestA >
{
template <class U> friend class MaGoTestB;
//template <class U> friend class MaGoTestF;
private:
public:
void M1( void ) ;
} ;
---- MaGoTest.hpp END ----
---- MaGoTest.cpp BEGIN ----
#include "MaGoTest.hpp"
void MaGoTestA::M1( void )
{
return ;
}
template< class T >
void MaGoTestB< T >::M2( void )
{
return ;
}
template< class T >
void MaGoTestF< T >::M3( void )
{
return ;
}
---- MaGoTest.hpp END ----
The error is:
In file included from
C:/Users/edotgm/Desktop/SRC/MaGo_Sample/SRC/MaGoTest.cpp:1:0:
C:/Users/edotgm/Desktop/SRC/MaGo_Sample/SRC/MaGoTest.hpp:29:41: error:
specialization of 'MaGoTestB<MaGoTestA>' after instantiation
make: *** [obj/local/armeabi/objs-debug/MaGoMmon/MaGoTest.o] Error 1
It's not clear to me if this is a c++ problem, an unsupported feature of
g++ or if I have to enable something through command line switches in g++ .
Hope there is someone in this NG who can enlighten me abiut this issue
Thanks
first of all I must apologize if I'm OT (and I fear I may be) but I
couldn't find a better NG (at least among the ones I have access to).
I can build this code in Visual Studio 2010 but g++ (android-ndk-r8d)
fails to build.
As you can see the problem has to do woth friendship and inheritance
B<T>
^
|
|
F<T>
^
|
|
A
---- MaGoTest.hpp BEGIN ----
template <class T>
class MaGoTestB
{
private:
T *mVar ;
public:
void M2( void ) ;
} ;
template <class T>
class MaGoTestF : public MaGoTestB< T >
{
private:
T *mVar ;
public:
void M3( void ) ;
} ;
class MaGoTestA : public MaGoTestF< MaGoTestA >
{
template <class U> friend class MaGoTestB;
//template <class U> friend class MaGoTestF;
private:
public:
void M1( void ) ;
} ;
---- MaGoTest.hpp END ----
---- MaGoTest.cpp BEGIN ----
#include "MaGoTest.hpp"
void MaGoTestA::M1( void )
{
return ;
}
template< class T >
void MaGoTestB< T >::M2( void )
{
return ;
}
template< class T >
void MaGoTestF< T >::M3( void )
{
return ;
}
---- MaGoTest.hpp END ----
The error is:
In file included from
C:/Users/edotgm/Desktop/SRC/MaGo_Sample/SRC/MaGoTest.cpp:1:0:
C:/Users/edotgm/Desktop/SRC/MaGo_Sample/SRC/MaGoTest.hpp:29:41: error:
specialization of 'MaGoTestB<MaGoTestA>' after instantiation
make: *** [obj/local/armeabi/objs-debug/MaGoMmon/MaGoTest.o] Error 1
It's not clear to me if this is a c++ problem, an unsupported feature of
g++ or if I have to enable something through command line switches in g++ .
Hope there is someone in this NG who can enlighten me abiut this issue
Thanks