error “base class has incomplete type”

时间:2021-07-11 12:02:50

error “base class has incomplete type”

如果base.h是你的基类,那么在子类derive中,写成如下形式:

class base;

class derive: public base{

}

那么就会出现如题的错误。解决这个错误的方法是:替换class base;成#include “base.h”