Can't import QtPositioning - "The specified module cannot be found", but module exists
-
Hi, I'm trying to import QtPositioning to a QML file with Qt 5.12.3. I'm building the project using a CMake file. When I try to run the program, I get the following error:
QQmlApplicationEngine failed to load component
qrc:/main.qml:3 plugin cannot be loaded for module "QtPositioning": Cannot load library D:\Dev\MyProject\build\bin\qml\QtPositioning\declarative_positioningd.dll: The specified module could not be found.Problem is, that dll exists at that location. This error message is very unhelpful and I do not know how to debug this issue. I've posted the source of all my relevant files here at Stack Overflow. I've also seen this similar post but the solution given does not work for me, the Qt5PositioningQuick.dll file is also present. Lastly I've seen this seemingly related bug, but not only does the fix not work for me, it should be fixed in >5.6 and I'm on 5.12.3.
Please help.
EDIT: I've just tried this in Qt Creator and it worked fine, so I suspect this has something to do with CMake. However, I've also tried adding Positioning to my imported modules in CMake to no avail. Unless I got the module name wrong or something, I don't know what else I can do there.
-
@christian.l
are you trying to run a deployed application (outside of QtCreator)?
If so you have to copy the (corresponding) contents of QTDIR/qml next to your executable or set a QML import path accordingly. -
@raven-worx I'm using Visual Studio with CMake. Qt Creator and .pro files are not involved whatsoever.
I've just tried both of those options, but neither solves the problem. I get the same error message.
-
@christian.l said in Can't import QtPositioning - "The specified module cannot be found", but module exists:
I've just tried both of those options
What have you tried exactly?
Settings an environment variable or callQQmlEngine::addImportPath()
is the easiest way. -
@raven-worx I tried copying the QtPositioning folder next to my executable with no luck. I then tried setting my QML2_IMPORT_PATH environment variable to <QTDIR>/qml.