编译错误笔记

1,error: template declaration of 'typedef'

typedef std::function<void(Input begin>  My_Func

 

解决方案:

template <typename Input>
using My_Func= std::function<void(Input begin>;

参考链接 :
https://stackoverflow.com/questions/19192122/template-declaration-of-typedef-typename-footbar-bar


2,error: field 'group_' has incomplete type
原因:使用了类的前置声明,但又进行了对你实例化,此时系统不知道为该对象分配多大空间;正确使用方式为:在使用前置声明时不要在头文件中直接定义对象,而是定义一个指针,在.cc文件中去new;

 

 2,error: const 二级指针:invalid conversion from 'char**' to 'const char**'

参考链接: https://blog.csdn.net/duyiwuer2009/article/details/39401801

3,Error: expected type-specifier before 'T'

原因:1)未引入类型T的头文件,引入相关头文件即可 ;

           2)可能该头文件中的#define  __*_H_在其他头文件中重复定义,查找重复使用#define 预编译项;

 

4,error: 'static' may not be used when defining (as opposed to declaring) a static data member [-fpermissive]

原因:在定义静态变量时,前面加了static关键字,去除这个sttic关键字即可,只需要在声明时加上static; 

 

posted @ 2020-02-11 15:49  郭流水  阅读(997)  评论(0编辑  收藏  举报