Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found
-
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?
-
@QtQrustacean said in Qt6.1.2: unknown type 'QStateMachine'; 'QStateMachine' file not found:
QStateMachine
add
QT += statemachine
in your .pro -
@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 -
@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
-
@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 image url)
-
@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 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.