Qt:没有规则来创建目标'../controlpanel.ui','ui_controlpanel.h' 需要。停止

Qt : No rule to make target '../controlpanel.ui', needed by 'ui_controlpanel.h'. Stop

我在Qt Creator 上遇到了一个很奇怪的问题。

:-1: error: No rule to make target '../controlpanel.ui', needed by 'ui_controlpanel.h'.  Stop.


mingw32-make[1]: *** No rule to make target '../controlpanel.ui', needed by 'ui_controlpanel.h'.  Stop.
mingw32-make: *** [debug] Error 2
makefile:34: recipe for target 'debug' failed
22:43:11: The process "C:\Qt\Qt5.4.0\Tools\mingw491_32\bin\mingw32-make.exe" exited with code 2.

这个项目之前编译好。但是现在我遇到了编译错误。 我在 Windows.

上使用 Qt creator 5.4.0

特别是,这个项目在Mac版本的Qt Creator 5.4.0上编译没有任何错误。

怎么了?我该如何解决这个错误?

这是一个 qmake 文件。

QT       += core gui opengl network multimedia

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = LaserdockVisualizer
TEMPLATE = app
INCLUDEPATH += .

# dwarf-2 for profiling
#QMAKE_CXXFLAGS += -gdwarf-2

include(../../LaserdockCore/LaserdockCore.pri)
QMAKE_MAC_SDK = macosx10.10

SOURCES += \
    main.cpp \
    LaserdockVisualizer/LaserdockVisualizerDelegate.cpp \
    LaserdockVisualizer/Form/LaserdockMainWindow.cpp \
    ...
    LaserdockVisualizer/Visualizations/Visualizers/Appakabar/Test/ldAppakabarTestSoundEventUtilVisualizer.cpp \
    LaserdockVisualizer/Visualizations/Visualizers/Appakabar/Test/ldAppakabarTestSoundEventUtilVisualizerControlPanel.cpp

HEADERS += \
    LaserdockVisualizer/LaserdockVisualizerDelegate.h \
    LaserdockVisualizer/Form/LaserdockMainWindow.h \
    ...
    LaserdockVisualizer/Visualizations/Visualizers/Appakabar/Test/ldAppakabarTestSoundEventUtilVisualizer.h \
    LaserdockVisualizer/Visualizations/Visualizers/Appakabar/Test/ldAppakabarTestSoundEventUtilVisualizerControlPanel.h


FORMS += \
    LaserdockVisualizer/Form/LaserdockMainWindow.ui \
    LaserdockVisualizer/Form/ldVisualizerControlPanelEmpty.ui \
    LaserdockVisualizer/Visualizations/Visualizers/ld3dCubeVisualizerControlPanel.ui \
    LaserdockVisualizer/Visualizations/Visualizers/Test/ldTestControlVisualizerControlPanel.ui \
    LaserdockVisualizer/Visualizations/Visualizers/Feldspar/ldWalkerVisualizerControlPanel.ui \
    LaserdockVisualizer/Visualizations/Visualizers/Test/ldTestCircleVisualizerControlPanel.ui \
    LaserdockVisualizer/Visualizations/Visualizers/Feldspar/test/ldMusicReactorTestVisualizerControlPanel.ui \
    LaserdockVisualizer/Visualizations/Visualizers/Feldspar/test/ldFrameTestVisualizerControlPanel.ui \
    LaserdockVisualizer/Visualizations/Visualizers/Appakabar/Test/ldappakabartestsoundeventutilvisualizercontrolpanel.ui

我找到了解决方案。

在Qt Creator上,进入"Projects Tab",然后就可以看到"Shadow build"。取消选中并编译。错误消失。

如果您只针对一个平台,

工作正常。但是,如果您正在为多个平台(例如,桌面和 Android)编译,您可以继续进行影子构建。这是我修复它的方法:

从“项目”选项卡中找到项目的构建目录:

转到该目录并删除找到的所有内容。 Qt 将简单地重新创建重建项目所需的所有文件。