Linux C++ Error: invalid use of incomplete type [How to Solve]

Reason: the compiler doesn’t know the concrete implementation of struct or class,

Analysis: it usually occurs in the following situations: suppose we have a class some defined in some. H, implemented in some. CPP, and we need to use the method of this some in other. CPP, so we can declare a class some in other. H, and declare the method to be used. This will lead to the above problems,

Solution: include some. H in other.cpp, so the compiler will find the specific definition of class some according to the header file, and the problem will be solved.


1. Forget to define the header file

2. There is no reference header file

Read More: