Code that works with qmake does not work with cmake
-
A QT project that works when I compile with Qmake, when I compile with cmake, the compilation completes, but it gives an error at runtime
error:
module "QtQuick.Controls" is not installed
module "QtQuick.Window" is not installed
module "QtQuick.Layouts" is not installed
module "QtQuick.Dialogs" is not installed
module "QtQuick.Controls" is not installed
module "QtQuick.Window" is not installed
module "QtQuick.Dialogs" is not installed
module "QtQuick.Layouts" is not installed
module "QtQuick.Controls" is not installed
module "QtQuick.Window" is not installed -
Hi @serkan_tr, and welcome!
Please share your CMakeLists.txt file
-
cmake_minimum_required(VERSION 3.10) project(QGroundControl LANGUAGES C CXX) include(GNUInstallDirs) find_package(Qt5Quick REQUIRED) find_package(Qt5Qml REQUIRED) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Coverage") qt5_add_qml_import_path("C:/Qt/5.15.2/msvc2019_64/qml") set(CMAKE_CXX_STANDARD 14) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) include(FeatureSummary) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options(-Wall -Wextra) endif() # CMake build type # Debug Release RelWithDebInfo MinSizeRel Coverage if (NOT CMAKE_BUILD_TYPE) # default to release with debug symbols set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type" FORCE) endif() # Add folder where are supportive functions list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # Configure Qt5 to get necessary variables include(Qt5QGCConfiguration) message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") message(STATUS "Qt version: ${QT_VERSION}") message(STATUS "Qt spec: ${QT_MKSPEC}") set(COMPANY "Mavlink") set(COPYRIGHT "Copyright (c) 2018 QGroundControl. All rights reserved.") set(IDENTIFIER "io.mavlink.qgroundcontrol") add_definitions( -DQGC_APPLICATION_NAME="QGroundControl" -DQGC_ORG_NAME="QGroundControl.org" -DQGC_ORG_DOMAIN="org.qgroundcontrol" ) include(Git) message(STATUS "QGroundControl version: ${APP_VERSION_STR}") #============================================================================= # ccache # option(CCACHE "Use ccache if available" ON) find_program(CCACHE_PROGRAM ccache) if (CCACHE AND CCACHE_PROGRAM AND NOT DEFINED ENV{CCACHE_DISABLE}) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") endif() #============================================================================= # Compile QML # option(COMPILE_QML "Pre-compile QML files using the Qt Quick compiler." FALSE) add_feature_info(COMPILE_QML COMPILE_QML "Pre-compile QML files using the Qt Quick compiler.") if(COMPILE_QML) find_package(Qt5QuickCompiler) set_package_properties(Qt5QuickCompiler PROPERTIES DESCRIPTION "Pre-compile QML files using the Qt Quick compiler." TYPE OPTIONAL ) endif() #============================================================================= # Debug QML # option(DEBUG_QML "Build QGroundControl with QML debugging/profiling support." FALSE) add_feature_info(DEBUG_QML DEBUG_QML "Build QGroundControl with QML debugging/profiling support.") if(DEBUG_QML) message(STATUS "To enable the QML debugger/profiler, run with: '-qmljsdebugger=port:1234'") add_definitions(-DQMLJSDEBUGGER) add_definitions(-DQT_DECLARATIVE_DEBUG) add_definitions(-DQT_QML_DEBUG) endif() #============================================================================= # GStreamer # find_package(PkgConfig) set(GST_DEPENDENCIES gstreamer-1.0>=1.14 gstreamer-video-1.0>=1.14 gstreamer-gl-1.0>=1.14 ) if (MSVC) pkg_check_modules(GST ${GST_DEPENDENCIES} ) else() pkg_check_modules(GST ${GST_DEPENDENCIES} egl ) endif() if (GST_FOUND) add_definitions( -DQGC_GST_STREAMING ) option(QGC_GST_MICROHARD_ENABLED "Enable microhard" OFF) option(QGC_GST_TAISYNC_ENABLED "Enable taisyng" OFF) else() if (QGC_GST_MICROHARD_ENABLED OR QGC_GST_TAISYNC_ENABLED) message(FATAL_ERROR "You tried to enable Microhard or Taisync but gstreamer is not found. Make sure to set PKG_CONFIG_EXECUTABLE and/or PKG_CONFIG_PATH properly.") endif() endif() #============================================================================= # Qt5 # find_package(Qt5 ${QT_VERSION} COMPONENTS Bluetooth Charts Concurrent Core Location Multimedia Network Positioning Quick QuickControls2 QuickWidgets OpenGL Sql Svg Test TextToSpeech Widgets Xml REQUIRED HINTS ${QT_LIBRARY_HINTS} ) if(NOT QT_MKSPEC MATCHES "winrt") find_package(Qt5 ${QT_VERSION} COMPONENTS SerialPort REQUIRED HINTS ${QT_LIBRARY_HINTS} ) endif() # Sets the default flags for compilation and linking. include(CompileOptions) include_directories( libs/eigen libs/libevents libs/mavlink/include/mavlink/v2.0 libs/mavlink/include/mavlink/v2.0/ardupilotmega libs/mavlink/include/mavlink/v2.0/common libs/shapelib ) add_subdirectory(libs) add_subdirectory(src) set(QGC_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/qgcimages.qrc ${CMAKE_CURRENT_SOURCE_DIR}/qgcresources.qrc ${CMAKE_CURRENT_SOURCE_DIR}/qgroundcontrol.qrc ${CMAKE_CURRENT_SOURCE_DIR}/resources/InstrumentValueIcons/InstrumentValueIcons.qrc ${CMAKE_CURRENT_SOURCE_DIR}/src/Airmap/airmap.qrc ${CMAKE_CURRENT_SOURCE_DIR}/src/Airmap/dummy/airmap_dummy.qrc ${CMAKE_CURRENT_SOURCE_DIR}/src/FirmwarePlugin/APM/APMResources.qrc ${CMAKE_CURRENT_SOURCE_DIR}/src/FirmwarePlugin/PX4/PX4Resources.qrc ${CMAKE_CURRENT_SOURCE_DIR}/VideoReceiverApp/qml.qrc ) if (WIN32) # append application icon resource for Windows set(QGC_RESOURCES ${QGC_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/deploy/windows/QGroundControl.rc) endif() if(BUILD_TESTING) list(APPEND QGC_RESOURCES UnitTest.qrc ) endif() if(ANDROID) add_library(QGroundControl SHARED ${QGC_RESOURCES}) else() add_executable(QGroundControl ${QGC_RESOURCES}) endif() target_link_libraries(QGroundControl PRIVATE qgc) #target_link_libraries(QGroundControl QtQuick Qt5Core Qt5Gui Qt5Qml Qt5Quick) # Files/directories to install install( TARGETS QGroundControl DESTINATION ${CMAKE_INSTALL_BINDIR} ) install( DIRECTORY ${CMAKE_SOURCE_DIR}/resources/ DESTINATION ${CMAKE_INSTALL_DATADIR}/qgroundcontrol ) install( FILES ${CMAKE_SOURCE_DIR}/deploy/org.mavlink.qgroundcontrol.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications ) install( FILES ${CMAKE_SOURCE_DIR}/resources/icons/qgroundcontrol.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/ RENAME org.mavlink.qgroundcontrol.png ) install( FILES ${CMAKE_SOURCE_DIR}/deploy/org.mavlink.qgroundcontrol.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo/ ) if(BUILD_TESTING) target_link_libraries(QGroundControl PRIVATE Qt5::Test) endif() if(NOT QT_MKSPEC MATCHES "winrt") target_link_libraries(QGroundControl PUBLIC Qt5::SerialPort ) endif() include(QGCDeploy)
-
Ah, you're using Qt 5. I don't use QML + CMake + Qt 5 myself, because CMake support wasn't very nice back then. It became a lot more powerful from Qt 6.2 onwards.
Anyway, set the following environment variables before running your application, and see if you can get any clues from the debug output:
QT_DEBUG_PLUGINS=1
QML_IMPORT_TRACE=1
Are you running from inside Qt Creator or outside?
-
@JKSH I am doing it inside the Qt creator application, these codes did not cause a problem in the ubuntu operating system, I started getting these errors after windows passed.
QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1
should i do it in cmake or do i have to do it in QT creator settings?
I got the same error again, it gives an error because it can't find these modules at runtime.
-
@serkan_tr said in Code that works with qmake does not work with cmake:
should i do it in cmake or do i have to do it in QT creator settings?
Those are environment variables. There are a few ways to set them:
- Using the Run Settings section in Qt Creator (see https://doc.qt.io/qtcreator/creator-run-settings.html#selecting-the-run-environment ), OR
- Calling
qputenv()
in main(), before you construct QGuiApplication (for example:qputenv("QT_DEBUG_PLUGINS", "1"); qputenv("QML_IMPORT_TRACE", "1");
)
it gives an error because it can't find these modules at runtime.
Yes, and setting those environment variables will provide clues as to why the modules can't be found at runtime.
-
@JKSH said in Code that works with qmake does not work with cmake:
@serkan_tr said in Code that works with qmake does not work with cmake:
should i do it in cmake or do i have to do it in QT creator settings?
Those are environment variables. There are a few ways to set them:
- Using the Run Settings section in Qt Creator (see https://doc.qt.io/qtcreator/creator-run-settings.html#selecting-the-run-environment ), OR
- Calling
qputenv()
in main(), before you construct QGuiApplication (for example:qputenv("QT_DEBUG_PLUGINS", "1"); qputenv("QML_IMPORT_TRACE", "1");
)
it gives an error because it can't find these modules at runtime.
Yes, and setting those environment variables will provide clues as to why the modules can't be found at runtime.
nothing changed, still getting the same erro
-
@serkan_tr
The hope was that those environment variables would give some "diagnostic" output when the application starts up. Are you running your app from e.g. Creator, perhaps built for debug? Does the "Application Output pane" show any such output? -
@serkan_tr said in Code that works with qmake does not work with cmake:
- Using the Run Settings section in Qt Creator (see https://doc.qt.io/qtcreator/creator-run-settings.html#selecting-the-run-environment ), OR
- Calling qputenv() in main(), before you construct QGuiApplication (for example: qputenv("QT_DEBUG_PLUGINS", "1"); qputenv("QML_IMPORT_TRACE", "1");)
To be sure would you like to show exactly whatever you did for whichever one of these?
-
I tried to use
qt5_import_qml_plugins
but it gave an error, there is no such command
NOTE:In addition, I would like to give you the following information. When compiled with qmake, it works without error, but when compiled with cmake, it gives this error.
Is it possible to run a cmake file inside the qmake file?
-
@serkan_tr
Please re-read and follow the instructions you were given:@JKSH said in Code that works with qmake does not work with cmake:
Using the Run Settings section in Qt Creator (see https://doc.qt.io/qtcreator/creator-run-settings.html#selecting-the-run-environment ), OR
You have asked and we have explained that these environment variables need to be set at runtime, not at build time. Yet you show you have put them into the Build nonetheless.....
-
@JonB said in Code that works with qmake does not work with cmake:
@serkan_tr
Please re-read and follow the instructions you were given:@JKSH said in Code that works with qmake does not work with cmake:
Using the Run Settings section in Qt Creator (see https://doc.qt.io/qtcreator/creator-run-settings.html#selecting-the-run-environment ), OR
You have asked and we have explained that these environment variables need to be set at runtime, not at build time. Yet you show you have put them into the Build nonetheless.....
QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/msvcp140_codecvt_ids.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/msvcp140_codecvt_ids.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Chartsd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Chartsd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Cored.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Cored.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Guid.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Guid.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Locationd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Locationd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Multimediad.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Multimediad.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Networkd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Networkd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Positioningd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Positioningd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5PositioningQuickd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5PositioningQuickd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Qmld.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Qmld.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5QmlModelsd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5QmlModelsd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Quickd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Quickd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5SerialPortd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5SerialPortd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Sqld.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Sqld.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Svgd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Svgd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Testd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Testd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5TextToSpeechd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5TextToSpeechd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Widgetsd.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Widgetsd.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Xmld.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Xmld.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/SDL2.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/SDL2.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/ucrtbase.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/ucrtbase.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/vcruntime140.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/vcruntime140.dll'" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/vcruntime140_1.dll" "Failed to extract plugin meta data from 'C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/vcruntime140_1.dll'" not a plugin QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/platformthemes" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/platformthemes" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/styles" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/styles" ... QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/styles/qwindowsvistastyled.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/styles/qwindowsvistastyled.dll, metadata= { "IID": "org.qt-project.Qt.QStyleFactoryInterface", "MetaData": { "Keys": [ "windowsvista" ] }, "archreq": 1, "className": "QWindowsVistaStylePlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("windowsvista") loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/styles/qwindowsvistastyled.dll" Settings location "C:/Users/emsar/AppData/Roaming/QGroundControl.org/QGroundControl.ini" Is writable?: true Filter rules "*Log.debug=false\nGStreamerAPILog.debug=true\nqt.qml.connections=false" System reported locale: QLocale(English, Latin, United States) ; Name "en_US" ; Preffered (used in maps): "en-US" QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/texttospeech" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/texttospeech" ... QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/texttospeech/qtexttospeech_sapid.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/texttospeech/qtexttospeech_sapid.dll, metadata= { "IID": "org.qt-project.qt.speech.tts.plugin/5.0", "MetaData": { "Features": [ ], "Keys": [ "sapi" ], "Provider": "sapi", "Version": 100 }, "archreq": 1, "className": "QTextToSpeechPluginSapi", "debug": true, "version": 331520 } Got keys from plugin meta data ("sapi") loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/texttospeech/qtexttospeech_sapid.dll" QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/mediaservice" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice" ... QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/dsengined.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/dsengined.dll, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "directshow" ], "Services": [ "org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer" ] }, "archreq": 1, "className": "DSServicePlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("directshow") QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/qtmedia_audioengined.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/qtmedia_audioengined.dll, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "audiocapture" ], "Services": [ "org.qt-project.qt.audiosource" ] }, "archreq": 1, "className": "AudioCaptureServicePlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("audiocapture") QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/wmfengined.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/wmfengined.dll, metadata= { "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0", "MetaData": { "Keys": [ "windowsmediafoundation" ], "Services": [ "org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiodecode" ] }, "archreq": 1, "className": "WMFServicePlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("windowsmediafoundation") QMediaPluginLoader: loading metadata for iid "org.qt-project.qt.mediaserviceproviderfactory/5.0" at location "/mediaservice" QMediaPluginLoader: Inserted index 0 into metadata: QJsonObject({"Keys":["directshow"],"Services":["org.qt-project.qt.camera","org.qt-project.qt.mediaplayer"],"index":0}) QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.camera" QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.mediaplayer" QMediaPluginLoader: Inserted index 1 into metadata: QJsonObject({"Keys":["audiocapture"],"Services":["org.qt-project.qt.audiosource"],"index":1}) QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.audiosource" QMediaPluginLoader: Inserted index 2 into metadata: QJsonObject({"Keys":["windowsmediafoundation"],"Services":["org.qt-project.qt.mediaplayer","org.qt-project.qt.audiodecode"],"index":2}) QMediaPluginLoader: Inserting new list for key: "org.qt-project.qt.audiodecode" loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/mediaservice/dsengined.dll" QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.camera" : ("directshow") QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.camera" : ("directshow") QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.camera" : ("directshow") QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.camera" : ("directshow") QMediaPluginLoader: loaded plugins for key "org.qt-project.qt.camera" : ("directshow") QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/position" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position" ... QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_positionpolld.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_positionpolld.dll, metadata= { "IID": "org.qt-project.qt.position.sourcefactory/5.0", "MetaData": { "Keys": [ "positionpoll" ], "Monitor": true, "Position": false, "Priority": 1000, "Provider": "positionpoll", "Satellite": false, "Testable": true }, "archreq": 1, "className": "QGeoPositionInfoSourceFactoryPoll", "debug": true, "version": 331520 } Got keys from plugin meta data ("positionpoll") QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_serialnmead.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_serialnmead.dll, metadata= { "IID": "org.qt-project.qt.position.sourcefactory/5.0", "MetaData": { "Keys": [ "serialnmea" ], "Monitor": false, "Position": true, "Priority": 1000, "Provider": "serialnmea", "Satellite": false, "Testable": false }, "archreq": 1, "className": "QGeoPositionInfoSourceFactorySerialNmea", "debug": true, "version": 331520 } Got keys from plugin meta data ("serialnmea") QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_winrtd.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_winrtd.dll, metadata= { "IID": "org.qt-project.qt.position.sourcefactory/5.0", "MetaData": { "Keys": [ "winrt" ], "Monitor": false, "Position": true, "Priority": 1000, "Provider": "winrt", "Satellite": false, "Testable": false }, "archreq": 1, "className": "QGeoPositionInfoSourceFactoryWinRT", "debug": true, "version": 331520 } Got keys from plugin meta data ("winrt") loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_serialnmead.dll" serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT. loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/position/qtposition_winrtd.dll" VideoReceiverLog: Stop called on empty URI VideoReceiverLog: Stop called on empty URI MAVLinkLogManagerLog: MAVLink logs directory: "C:/Users/emsar/OneDrive/Belgeler/QGroundControl/Logs" QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/bearer" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/bearer" ... QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/bearer/qgenericbearerd.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/bearer/qgenericbearerd.dll, metadata= { "IID": "org.qt-project.Qt.QBearerEngineFactoryInterface", "MetaData": { "Keys": [ "generic" ] }, "archreq": 1, "className": "QGenericEnginePlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("generic") loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/bearer/qgenericbearerd.dll" Map Cache in: "C:/Users/emsar/AppData/Local/cache/QGCMapCache300" / "qgcMapCache.db" QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/sqldrivers" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers" ... QQmlImportDatabase::addImportPath: "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/qml" QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlited.dll" QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports" QQmlImportDatabase::addImportPath: "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlited.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "archreq": 1, "className": "QSQLiteDriverPlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("QSQLITE") QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlodbcd.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlodbcd.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QODBC3", "QODBC" ] }, "archreq": 1, "className": "QODBCDriverPlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("QODBC3", "QODBC") QFactoryLoader::QFactoryLoader() looking at "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlpsqld.dll" Found metadata in lib C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlpsqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 1, "className": "QPSQLDriverPlugin", "debug": true, "version": 331520 } Got keys from plugin meta data ("QPSQL7", "QPSQL") loaded library "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/sqldrivers/qsqlited.dll" QQmlImportDatabase::addImportPath: "qrc:/qml" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QtQuick" 2.11 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QtQuick.Controls" 2.4 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QtQuick.Dialogs" 1.3 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QtQuick.Layouts" 1.11 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QtQuick.Window" 2.11 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QGroundControl" 1.0 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QGroundControl.Palette" 1.0 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QGroundControl.Controls" 1.0 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::importExtension: loaded ":/qml/QGroundControl/Controls/qmldir" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QGroundControl.ScreenTools" 1.0 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::importExtension: loaded ":/qml/QGroundControl/ScreenTools/qmldir" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QGroundControl.FlightDisplay" 1.0 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::importExtension: loaded ":/qml/QGroundControl/FlightDisplay/qmldir" QQmlImports(qrc:/qml/MainRootWindow.qml)::addLibraryImport: "QGroundControl.FlightMap" 1.0 as "" QQmlImports(qrc:/qml/MainRootWindow.qml)::importExtension: loaded ":/qml/QGroundControl/FlightMap/qmldir" QQmlApplicationEngine failed to load component qrc:/qml/MainRootWindow.qml:14:1: module "QtQuick.Window" is not installed qrc:/qml/MainRootWindow.qml:13:1: module "QtQuick.Layouts" is not installed qrc:/qml/MainRootWindow.qml:12:1: module "QtQuick.Dialogs" is not installed qrc:/qml/MainRootWindow.qml:11:1: module "QtQuick.Controls" is not installed qrc:/qml/MainRootWindow.qml:14:1: module "QtQuick.Window" is not installed qrc:/qml/MainRootWindow.qml:13:1: module "QtQuick.Layouts" is not installed qrc:/qml/MainRootWindow.qml:12:1: module "QtQuick.Dialogs" is not installed qrc:/qml/MainRootWindow.qml:11:1: module "QtQuick.Controls" is not installed qrc:/qml/MainRootWindow.qml:14:1: module "QtQuick.Window" is not installed qrc:/qml/MainRootWindow.qml:13:1: module "QtQuick.Layouts" is not installed qrc:/qml/MainRootWindow.qml:12:1: module "QtQuick.Dialogs" is not installed qrc:/qml/MainRootWindow.qml:11:1: module "QtQuick.Controls" is not installed qrc:/qml/MainRootWindow.qml:14:1: module "QtQuick.Window" is not installed qrc:/qml/MainRootWindow.qml:13:1: module "QtQuick.Layouts" is not installed qrc:/qml/MainRootWindow.qml:12:1: module "QtQuick.Dialogs" is not installed qrc:/qml/MainRootWindow.qml:11:1: module "QtQuick.Controls" is not installed QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.2/msvc2019_64/plugins/platforms/accessiblebridge" ... QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/accessiblebridge" ... "v4.2.0"
this time it gave such an error, thank you very much for your help
I can only share this much because it is too long mistake -
@serkan_tr said in Code that works with qmake does not work with cmake:
this time it gave such an error, thank you very much for your help
I can only share this much because it is too long mistakeIt's not an error, it's a debug log.
Two things look very strange to me:
- Your program is trying to load C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Cored.dll as a plugin. This should not happen.
- Your program only adds one import path (
QQmlImportDatabase::addImportPath: "qrc:/qml"
). It should add a few different paths, including the folder that contains Qt5Cored.dll.
Delete C:/Users/emsar/workspace/Qt/build-qgroundcontrol-Debug/Qt5Cored.dll and try again. If it still doesn't work, post your updated debug log.
-
@JKSH
thank you very much for telling me where to look it doesn't seem to work properly but it worked.
I think the reason for the problem is that the naming of the files it creates is wrong.
The resulting filenames are as follows: Qt5Quickd.dll,
Qt5Network.dll
..
delete and save the d at the end of these filenames and run
Qt5Quick.dll,
Qt5Network.dll -
@serkan_tr You're welcome.
The
d
suffix indicates a Debug DLL.- If you create a Debug build, then your application will link to
Qt5Quickd.dll
- If you create a Release build, then your application will link to
Qt5Quick.dll
If your application cannot find C:\Users\emsar\workspace\Qt\build-qgroundcontrol-Debug\Qt5Quickd.dll, then it will look for C:\Qt\5.15.2\msvc2019_64\bin\Qt5Quickd.dll
This all means that your original problem was a deployment problem. It was not related to qmake or CMake.
- If you create a Debug build, then your application will link to
-
@JKSH said in Code that works with qmake does not work with cmake:
@serkan_tr You're welcome.
The
d
suffix indicates a Debug DLL.- If you create a Debug build, then your application will link to
Qt5Quickd.dll
- If you create a Release build, then your application will link to
Qt5Quick.dll
If your application cannot find C:\Users\emsar\workspace\Qt\build-qgroundcontrol-Debug\Qt5Quickd.dll, then it will look for C:\Qt\5.15.2\msvc2019_64\bin\Qt5Quickd.dll
This all means that your original problem was a deployment problem. It was not related to qmake or CMake.
Now I'm starting to understand a little more
but at the end it worked without error when d was deleted. Is it because it was pulled from the qt folder, not directly from the file? - If you create a Debug build, then your application will link to