Deletion of pointer to incomplete type 'Point'; no destructor called
c++, class, destructor, pointers
Solution
You need to add `#include "Point.h"` into your file `Line.h`. You can only construct and delete complete types.
Alterntively, remove the member function definitions from `Line.h`, and put them in a separate file `Line.cpp`, and include `Point.h` and `Line.h` in that file. This is a typical dependency reduction technique which makes code faster to compile, although at a potential loss of certain inlining opportunities.
Problem
I have 2 files: `Point.h`: ``` class Point { int x; int y; char* name; public: Point() { name = new char[5]; } ~Point() { delete[] name; } }; ``` and: `Line.h`: ``` class Point; class Line { Point* p; public: Line() { p = new Point[2]; .... ... } ~Line() { delete[] p; } }; ``` but when I compile, I got the next error: ``` deletion of pointer to incomplete type 'Point'; no destructor called ``` any help appreciated!