Class 'is not a template type'

前端 未结 7 1993
暗喜
暗喜 2021-01-07 21:54

What does this error mean?

Generic.h:25: error: \'Generic\' is not a template type

Here\'s Generic.

template 

        
7条回答
  •  没有蜡笔的小新
    2021-01-07 22:28

    Your problem is that you are defining visitor of type Generic with no template param.

    When you forward declared the class as Generic then at line 15 the compiler found the declaration. But when you changed the declaration with template then the class Generic is no longer found.

    So, you should do something like:

    template 
    class Generic;
    
    class Property : public CFG {
        Generic *visitor; // line 15
    

    or

    template 
    class Generic;
    
    template 
    class Property : public CFG {
        Generic *visitor; // line 15
    

    or something like that.

提交回复
热议问题