Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found
-
wrote on 4 Aug 2021, 19:15 last edited by
I'm trying to build a project I have. In Qt 5, it builds fine. In Qt 6.1.2 I get the errors listed in the title of this post, as well as
'QStateMachine': No such file or directoryI'm also getting these errors for QState, minus the unknown type error.
Currently, the official Qt6 Documentation says QStateMachine exists in the language. I know it was not put in right at the 6.0 release, but they added it between then and 6.1.2. Thus it is pretty confusing to be getting these build errors. Any idea what's going wrong here?
-
I'm trying to build a project I have. In Qt 5, it builds fine. In Qt 6.1.2 I get the errors listed in the title of this post, as well as
'QStateMachine': No such file or directoryI'm also getting these errors for QState, minus the unknown type error.
Currently, the official Qt6 Documentation says QStateMachine exists in the language. I know it was not put in right at the 6.0 release, but they added it between then and 6.1.2. Thus it is pretty confusing to be getting these build errors. Any idea what's going wrong here?
wrote on 4 Aug 2021, 19:22 last edited by@QtQrustacean said in Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found:
QStateMachine
add
QT += statemachine
in your .pro -
@QtQrustacean said in Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found:
QStateMachine
add
QT += statemachine
in your .prowrote on 4 Aug 2021, 20:16 last edited by@eyllanesc said in Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found:
QT += statemachine
I tried that at the top of my .pro, and got this build error:
error: Unknown module(s) in QT: statemachine -
@eyllanesc said in Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found:
QT += statemachine
I tried that at the top of my .pro, and got this build error:
error: Unknown module(s) in QT: statemachinewrote on 4 Aug 2021, 20:47 last edited by eyllanesc 8 Apr 2021, 20:48@QtQrustacean Are you sure you are using Qt6.1 or higher? QStateMachine was moved to a new module called QtStateMachine so you must add
QT += statemachine
to the .pro as indicated in the docs: https://doc.qt.io/qt-6/qstatemachine.html . Maybe you need to install this module so run the Qt Maintenance Tool and verify that this module is installed, and if not then install it.Also it would be good if you indicate what your OS is and how you have installed Qt6
-
@QtQrustacean Are you sure you are using Qt6.1 or higher? QStateMachine was moved to a new module called QtStateMachine so you must add
QT += statemachine
to the .pro as indicated in the docs: https://doc.qt.io/qt-6/qstatemachine.html . Maybe you need to install this module so run the Qt Maintenance Tool and verify that this module is installed, and if not then install it.Also it would be good if you indicate what your OS is and how you have installed Qt6
wrote on 5 Aug 2021, 14:41 last edited by@eyllanesc I think so.
I'm on Windows 10. I downloaded the Qt Online Installer (qt-unified-windows-x86-4.1.1-online.exe) from Qt's site and followed its prompts to install.
In Qt Creator 4.15.2, when I go to Tools>Options, the Kit auto-detect for my project says Desktop Qt 6.1.2 MinGW 64-bit.
-
@eyllanesc I think so.
I'm on Windows 10. I downloaded the Qt Online Installer (qt-unified-windows-x86-4.1.1-online.exe) from Qt's site and followed its prompts to install.
In Qt Creator 4.15.2, when I go to Tools>Options, the Kit auto-detect for my project says Desktop Qt 6.1.2 MinGW 64-bit.
wrote on 5 Aug 2021, 15:16 last edited by@eyllanesc
image url)
-
@QtQrustacean Are you sure you are using Qt6.1 or higher? QStateMachine was moved to a new module called QtStateMachine so you must add
QT += statemachine
to the .pro as indicated in the docs: https://doc.qt.io/qt-6/qstatemachine.html . Maybe you need to install this module so run the Qt Maintenance Tool and verify that this module is installed, and if not then install it.Also it would be good if you indicate what your OS is and how you have installed Qt6
wrote on 5 Aug 2021, 19:56 last edited by@eyllanesc Ok I used the tool to install Qt State Machines, but when I tried to build without the line QT += statemachine in my .pro file, I got the same errors as before. If I added that line, I got the error: Unknown module(s) in QT: statemachine So even though I installed Qt State Machines, nothing seems to have changed. I confirmed with the maintenance tool that it is actually installed.
-
@eyllanesc Ok I used the tool to install Qt State Machines, but when I tried to build without the line QT += statemachine in my .pro file, I got the same errors as before. If I added that line, I got the error: Unknown module(s) in QT: statemachine So even though I installed Qt State Machines, nothing seems to have changed. I confirmed with the maintenance tool that it is actually installed.
@QtQrustacean Did you make sure that you use the auto-detected 6.1.2 Kit for building?
-
@QtQrustacean Did you make sure that you use the auto-detected 6.1.2 Kit for building?
wrote on 6 Aug 2021, 14:41 last edited by@jsulm Yes, when I click The project name above the icon of a screen to set the build config, it shows 6.1.2 . This is what the toolbar menu action, Build > Open Build and Run Kit Selector opens as well.
-
@jsulm Yes, when I click The project name above the icon of a screen to set the build config, it shows 6.1.2 . This is what the toolbar menu action, Build > Open Build and Run Kit Selector opens as well.
wrote on 12 Aug 2021, 18:16 last edited by@QtQrustacean You may need to re-install Qt. I installed the default Qt for Desktop Applications from the installer (6.1.2), and had the same problem you did. By deleting that version of Qt and doing the Custom build, I was able to select Qt 6.1.2 and then add the Qt StateMachine package in the same area. So far, what I did is working.
1/10