Missing QObject build dependency
-
I've been stuck on this issue for far too long. I am trying to build an application using Qt 5.15.2 and C++ compiler 16.5.29911.84 (x86_amd64). However no matter what I try I seem to get the same error:
Dependent '..\..\..\..\..\Qt\5.15.2\msvc2019_64\QtCore\QObject does not exist
I've tried the following:- Checking to see if QObject exists at the specified path (it does)
- Changing the INCLUDEPATH in my .pro file to include "C:\Qt\5.15.2\msvc2019_64\include\QtCore" which is where QObject lives
- Confirmed that my header file defines QTObject as: #include <QObject>
- Verified my .pro file has the QT Flag: QT += core
- Defined Environment Variable on my Windows machine as QTDir = C:\Qt\5.15.2\msvc2019_64 and added %ATDIR%\bin to my PATH variable
- Uninstalled and reinstalled Qt
After each of these changes I clean the project, run qmake and then build the project. However, each time the build fails with the original error.
Any suggestions of how to fix the problem or narrow down the issue would be greatly appreciated. Thank you
-
Hi and welcome to devnet,
Are you using Qt Creator ? Visual Studio ? The command line ?
-
@SGaist Hello, I am using Qt Creator.
I've narrowed down the problem to an incorrect filepath in the makefiles. If I change the path from
..\..\..\..\..\Qt\5.15.2\*
toC:\Qt\5.15.2
the application builds.
Where do I specify this path in Qt such that it uses the absolute path and not the relative path?Thank you
-
Hi,
Did anything change such as an update to the toolchain, Windows, anti-virus, etc. ?
-
@SGaist Not that I know.
By adding "QMAKE_PROJECT_DEPTH = 0" I was able to compile again, but there seems to be something wrong with my QT-installation.
I just had another problem:
I created a new, empty "Qt Quick Application" with QT 6.8.0.
I was not even able to compile as I directly get the error: "Failed to scan target apptestapp for QML imports"
According to following output, it looks like QT suddenly has a problem with my repository-directory (it has a space in the name" but that was never a problem in the past.Anyway, changing the path only fixes the second problem. Without QMAKE_PROJECT_DEPTH = 0 I'm still not able to compile my older projects.
[cmake] Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S "C:/Development Repositories/TestProjects/testapp" -B "C:/Development Repositories/TestProjects/testapp/build/Desktop_Qt_6_8_0_MSVC2022_64bit-Debug" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.8.0/msvc2022_64" "-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG" "-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON" "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_C_COMPILER:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/bin/HostX64/x64/cl.exe" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\Development Repositories\TestProjects\testapp\build\Desktop_Qt_6_8_0_MSVC2022_64bit-Debug/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.8.0/msvc2022_64/bin/qmake.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/bin/HostX64/x64/cl.exe" in C:\Development Repositories\TestProjects\testapp\build\Desktop_Qt_6_8_0_MSVC2022_64bit-Debug. [cmake] -- The CXX compiler identification is MSVC 19.42.34433.0 [cmake] -- Detecting CXX compiler ABI info [cmake] -- Detecting CXX compiler ABI info - done [cmake] -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/bin/HostX64/x64/cl.exe - skipped [cmake] -- Detecting CXX compile features [cmake] -- Detecting CXX compile features - done [cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD [cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed [cmake] -- Looking for pthread_create in pthreads [cmake] -- Looking for pthread_create in pthreads - not found [cmake] -- Looking for pthread_create in pthread [cmake] -- Looking for pthread_create in pthread - not found [cmake] -- Found Threads: TRUE [cmake] -- Performing Test HAVE_STDATOMIC [cmake] -- Performing Test HAVE_STDATOMIC - Success [cmake] -- Found WrapAtomic: TRUE [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] Der Befehl "C:/Development" ist entweder falsch geschrieben oder [cmake] konnte nicht gefunden werden. [cmake] CMake Error at C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3859 (message): [cmake] Failed to scan target apptestapp for QML imports: 1 [cmake] Call Stack (most recent call first): [cmake] C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3901 (_qt_internal_scan_qml_imports) [cmake] C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:753 (qt6_import_qml_plugins) [cmake] C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:753 (cmake_language) [cmake] C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:851 (_qt_internal_finalize_executable) [cmake] C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:820:EVAL:1 (qt6_finalize_target) [cmake] CMakeLists.txt:DEFERRED [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] [cmake] The command "C:\Qt\Tools\CMake_64\bin\cmake.exe -S "C:/Development Repositories/TestProjects/testapp" -B "C:/Development Repositories/TestProjects/testapp/build/Desktop_Qt_6_8_0_MSVC2022_64bit-Debug" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DCMAKE_PREFIX_PATH:PATH=C:/Qt/6.8.0/msvc2022_64" "-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG" "-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON" "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_C_COMPILER:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/bin/HostX64/x64/cl.exe" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\Development Repositories\TestProjects\testapp\build\Desktop_Qt_6_8_0_MSVC2022_64bit-Debug/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Qt/6.8.0/msvc2022_64/bin/qmake.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/bin/HostX64/x64/cl.exe"" terminated with exit code 1. [cmake] [cmake] Elapsed time: 00:04.
-
Does 6.8.2 behave in a similar fashion ?
-
I hat such errors appearing suddenly also, and what helped was to put the build directory next to the source directory, not below the source dir as QtCreator does nowadays.
For me, that was with make projects and Qt 5.15.
Regards