[Insight-users] Compilation Error : "typename X is implicitly a typename"

Luis Ibanez luis.ibanez at kitware.com
Tue Jul 12 19:22:55 EDT 2005



Hi Mukul,


1) Please *NEVER* use the statement

         "using namespace std"

    This opens the std namespace and defeats
    the purpose of namespaces.  Please get
    used to typing the full scope of a symbol
    such as

      std::cout
      std::vector< double >
      std::list< int >


    and so on....





2) The compilaion errorr that you get in the line


       template<typename T>
       List<T>::records* List<T>::linkList = 0;


       "typename List<T>::records'
           is implicitly a typename"


    Means that you are using a trait from a templated
    class, and that you *MUST* qualify that trait as
    a type in order to avoid confusions with functions
    names and static variables.

    The solution is to add the "typename" keyword before
    the trait that you are trying to use.

    like in:

      template<typename T>
      typename List<T>::records* List<T>::linkList = 0;

    in this way the compiler will know that "records"
    is a type defined inside the class "List", instead
    of being a method of "List", or a static variable
    of the "List" class.




   Regards,



      Luis



--------------------
Mukul Dutt wrote:

> Hi Luis
> 
> While compiling attached program on Linux 9.0 platform...
> I am getting following warnings... and not able to resolve...
> 
> genCls1.cpp:27: warning: `typename List<T>::records' is implicitly a 
> typename
> genCls1.cpp:27: warning: implicit typename is deprecated, please see the
>   documentation for details
> genCls1.cpp:30: warning: `typename List<T>::records' is implicitly a 
> typename
> genCls1.cpp:30: warning: implicit typename is deprecated, please see the
>   documentation for details
> 
> Please guide me.
> 
> HAVE A NICE DAY
> ---------------------
> Mukul Chandra Dutt
> Software Engineer
> SoftJin Infotech Pvt. Ltd.
> No. 227/70/A, Sigma Arcade 1
> Airport Road, Marathhalli
> Bangalore-560037
> Phone no: 
> Mobile:09886583271
> Office:080-25234641/42  Ext.-256
> 
> 
> <http://clients.rediff.com/signature/track_sig.asp>





More information about the Insight-users mailing list