Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. error: 'QIcon' is an incomplete type
Forum Updated to NodeBB v4.3 + New Features

error: 'QIcon' is an incomplete type

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aphrodites
    wrote on last edited by
    #1

    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:

    window.setWindowIcon(QIcon("logo.png"));
    

    I have an error now that says:

    qttest.cpp:18:26: error: 'QIcon' is an incomplete type
        window.setWindowIcon(QIcon("logo.png"));
                             ^
    /usr/local/Cellar/qt/5.12.0/lib/QtCore.framework/Headers/qmetatype.h:1971:1: note: 
          forward declaration of 'QIcon'
    QT_FOR_EACH_STATIC_GUI_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER)
    ^
    /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?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved