invalid use of incomplete type ‘blah’

When you try and compile some code and you get an error along the lines of invalid use of an incomplete type ‘whatever type’ then in most cases it means you need to include the header file where that type is displayed.

For example I had the following events in my header file:

    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

When when I tried to compile gave the following error:
invalid use of incomplete type ‘struct QGraphicsSceneMouseEvent’

This was because the compiler could not find details of the struct and hence the details. To fix the problem I need to include the header.

This of course is similar to the initialized but not complete error but subtly different.

Published by

Amit Bahree

This blog is my personal blog and while it does reflect my experiences in my professional life, this is just my thoughts. Most of the entries are technical though sometimes they can vary from the wacky to even political – however that is quite rare. Quite often, I have been asked what’s up with the “gibberish” and the funny title of the blog? Some people even going the extra step to say that, this is a virus that infected their system (ahem) well. [:D] It actually is quite simple, and if you have still not figured out then check out this link – whats in a name?

One thought on “invalid use of incomplete type ‘blah’”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.