|— Configuring done
— Generating done
Running ‘D:/Qt/Tools/Ninja/ninja.exe’ ‘-C’ ‘D:/code/build-EFR-linux247-Debug’ ‘-t’ ‘recompact’ failed with: ninja: error: build.ninja:1802: multiple rules generate Debug/xxx.exe [-w dupbuild=err]
Duplicate multiple targets
CMAKE If the specified target is the same as the target path automatically generated by qt, this problem will occur
Modify the target path
In the project, QT6 is used 2.1 after installing QT, this error is reported when QtCreator is used:
but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
FOUND. Reason given by package:
Failed to find Qt component "Widgets" config file at ""
The reason is that although QT has been installed, some other libraries QT depends on have not been installed:
I use Ubuntu system: use the following command to install (OpenGL installation)
sudo apt-get install build-essential libgl1-mesa-dev
When we want to use the file dialog box in the interface, we can use the FileDialog component with the following code:
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Dialogs 1.3
text: qsTr("Open the Files")
title: qsTr("Please choose a file")
nameFilters: ["Photo Files", "Image Files (*.jpg *.png *.gif *.bmp *.ico)", "*.*"]
_filePath.text = String(fileUrl)
var filepath = new String(fileUrl)
file:///D:/Qt/Qt5.12.6/5.12.6/msvc2017_64/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: Failed to initialize QSettings instance. Status code is: 1
file:///D:/Qt/Qt5.12.6/5.12.6/msvc2017_64/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: The following application identifiers have not been set: QVector("organizationName", "organizationDomain")
Add a line of code to the main function of main.cpp.
QCoreApplication::setOrganizationName("appName.org");//appName.org can be set at will
Recently in business development need to update the UI in the QThread, if the UI handle through the direct update will make the program reported an error, because the update of the UI in the thread will not be captured by the original thread of the EXEC event, will lead to message event blockage generated ERROR, so the use of the signal and slot mechanism, and then I declared a signals signal in the QThread, the compilation reported this error.
The "QtRunWork" task returned false but did not log an error
No detailed warning was given, and I later checked the relevant QT instructions to solve the problem.
Solution: Add a line of macro definition to the class where you use signals and slots.
This will work, the signal and slotted based on Q_OBJECT, we need to declare it module to our class so that the QT compiler can instantiate it, otherwise it will be exception ERROR.
QT compilation error:
error: undefined reference to `vtable ...`
1.Qt uses signals and slots to implement communication features.
2.Signals and slots can be used when the class is derived from QObject and the Q_OBJECT macro is added to the header file.
3.When Q_OBJECT is added to the class header file QtCreator will automatically create a moc_***.cpp file that implements the code for signal and slot communication.
4.However, sometimes when we create a class through QtCreator without selecting the IDE option to derive it from the QObject class, but add it later, QtCreator will not automatically create the moc_***.cpp file. In this case it will report an error: undefined reference to `vtable for ***.
According to various online methods, it can not be solved, nor can
mine is a small project. Just delete the
build-XXX folder and rebuild it.
I recently upgraded QT from QT5.12.9 to QT5.15.2, and the compiler reported
error C4996: 'QWheelEvent::pos': Use position()
Reson and Solution:
It’s easy to see that the new version has changed
QWheelEvent::position, and the code changes pos to position.