Qt World Summit: Submit your Presentation

error: 'QIcon' is an incomplete type

  • I am beginning to learn Qt and want to test icons. I am on a MacBook Pro 2018 running MacOS 10.14 and Qt 3.0.6. I put this line in my main.cpp:


    I have an error now that says:

    qttest.cpp:18:26: error: 'QIcon' is an incomplete type
    /usr/local/Cellar/qt/5.12.0/lib/QtCore.framework/Headers/qmetatype.h:1971:1: note: 
          forward declaration of 'QIcon'
    /usr/local/Cellar/qt/5.12.0/lib/QtCore.framework/Headers/qmetatype.h:153:18: note: 
          expanded from macro 'QT_FOR_EACH_STATIC_GUI_CLASS'
        F(QIcon, 69, QIcon) \
    1 error generated.

    My main.pro has QT += core and QT += widgets, and nothing else. What is wrong with my installation of Qt? How to refresh my installation? What should I do?

  • Moderators

    Hi, welcome to the forum.
    Seems you're just missing an include: #include <QIcon>.

Log in to reply