Unsolved 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:
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?
-
Hi, welcome to the forum.
Seems you're just missing an include:#include <QIcon>
.