onedrive_tray icon indicating copy to clipboard operation
onedrive_tray copied to clipboard

invalid use of incomplete type ‘class QActionGroup’

Open dmaglio opened this issue 2 years ago • 4 comments

i try to compile in F37 and this is the error:

g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../onedrive_tray -I. -I../../onedrive_tray -I/usr/include/qt6 -I/usr/include/qt6/QtWidgets -I/usr/include/qt6/QtGui -I/usr/include/qt6/QtCore -I. -I/usr/lib64/qt6/mkspecs/linux-g++ -o window.o ../window.cpp
../window.cpp: In member function ‘void Window::createActions()’:
../window.cpp:474:43: error: invalid use of incomplete type ‘class QActionGroup’
  474 |     iconColorGroup = new QActionGroup(this);
      |                                           ^
In file included from /usr/include/qt6/QtWidgets/qwidget.h:11,
                 from /usr/include/qt6/QtWidgets/qframe.h:8,
                 from /usr/include/qt6/QtWidgets/qabstractscrollarea.h:8,
                 from /usr/include/qt6/QtWidgets/qtextedit.h:8,
                 from /usr/include/qt6/QtWidgets/qplaintextedit.h:8,
                 from /usr/include/qt6/QtWidgets/QPlainTextEdit:1,
                 from ../window.h:5,
                 from ../window.cpp:1:
/usr/include/qt6/QtGui/qaction.h:21:7: note: forward declaration of ‘class QActionGroup’
   21 | class QActionGroup;
      |       ^~~~~~~~~~~~
../window.cpp:490:23: error: invalid use of incomplete type ‘class QActionGroup’
  490 |         iconColorGroup->addAction(iconColorAction);
      |                       ^~
/usr/include/qt6/QtGui/qaction.h:21:7: note: forward declaration of ‘class QActionGroup’
   21 | class QActionGroup;
      |       ^~~~~~~~~~~~
../window.cpp:497:19: error: invalid use of incomplete type ‘class QActionGroup’
  497 |     iconColorGroup->addAction(moreColorsAction);
      |                   ^~
/usr/include/qt6/QtGui/qaction.h:21:7: note: forward declaration of ‘class QActionGroup’
   21 | class QActionGroup;
      |       ^~~~~~~~~~~~
../window.cpp: In member function ‘void Window::createTrayIcon()’:
../window.cpp:532:44: error: invalid use of incomplete type ‘class QActionGroup’
  532 |     submenuColor->addActions(iconColorGroup->actions());
      |                                            ^~
/usr/include/qt6/QtGui/qaction.h:21:7: note: forward declaration of ‘class QActionGroup’
   21 | class QActionGroup;
      |       ^~~~~~~~~~~~
make: *** [Makefile:402: window.o] Errore 1

dmaglio avatar Jan 24 '23 16:01 dmaglio

This happens if you try to use qmake from Qt6. You don't get this error if you use Qt5

ga2k avatar May 20 '23 23:05 ga2k

This happens if you try to use qmake from Qt6. You don't get this error if you use Qt5

Yes, that's it.

@dmaglio make sure you install the package qt5-qtbase-devel and use qmake-qt5 instead of just qmake.

Context: just did the same on Fedora 38.

ttntm avatar Oct 19 '23 08:10 ttntm

I had the same error a bit ago and adding the following to window.cpp fixed it.

#include <QActionGroup>

SamD2021 avatar Mar 04 '24 22:03 SamD2021