DanielBorgesOliveira / onedrive_tray

OneDrive system tray program
GNU General Public License v3.0
113 stars 21 forks source link

invalid use of incomplete type ‘class QActionGroup’ #45

Open dmaglio opened 1 year ago

dmaglio commented 1 year ago

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
ga2k commented 1 year ago

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

ttntm commented 10 months ago

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.

SamD2021 commented 5 months ago

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

#include <QActionGroup>