I have an app that its project generated using CMake
in Qt5.7
,
so when import QtQuick.Controls 2.0
application failed to load with the following error:
plugin cannot be loaded for module "QtQuick.Controls": Cannot load library C:\Qt\Qt5.7.0\5.7\msvc2015\qml\QtQuick\Controls.2\qtquickcontrols2plugind.dll: The specified module could not be found.
CMakeLists.txt
set(CMAKE_PREFIX_PATH "C:\\Qt\\Qt5.7.0\\5.7\\msvc2015")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Qml)
find_package(Qt5Quick)
find_package(Qt5QuickControls2)
...
add_executable(MyApp ${SRC} ${HEADER} ${RESOURCES})
target_link_libraries(MyApp
Qt5::WinMain
Qt5::Core
Qt5::Qml
Qt5::Quick
Qt5::QuickControls2
)
The DLL
file loaded in visual studio output:
'MyApp.exe' (Win32): Loaded 'C:\Qt\Qt5.7.0\5.7\msvc2015\qml\QtQuick.2\qtquick2plugind.dll'. Symbols loaded.
'MyApp.exe' (Win32): Loaded 'C:\Qt\Qt5.7.0\5.7\msvc2015\qml\QtQuick\Controls.2\qtquickcontrols2plugind.dll'. Symbols loaded.
'MyApp.exe' (Win32): Unloaded 'C:\Qt\Qt5.7.0\5.7\msvc2015\qml\QtQuick\Controls.2\qtquickcontrols2plugind.dll'
C:\Qt\Qt5.7.0\5.7\msvc2015\qml\QtQuick\Controls.2
? It looks like it's trying to find the debug version of the plugin, but does your Qt installation have it available? – jpnurmi