QT moc class 找不到原始文件,尽管它在正确的目录中
QT moc class can not find the original file, despite it being in correct directory
我正在尝试构建 qt 项目,但我不断收到有关 moc object moc_SerialPortManager.cpp 中不存在 header 的错误。我用 bash 移动到那个目录,并使用 cd cmd 和用 mock object 编写的路径,它会引导到正确的目录。有没有人知道如何解决它?在这一点上,这是一个相当大的项目,所以请告诉我我可以发布什么来让你更容易?
我在 git https://github.com/Orpiczy/AcornScanner/compare/fronAndBackJoin 上都有,如果你想查看
我正在使用适用于 C++ 和 Qt 6.2.0 的 Mingw 编译器 8.1.0 64 位,我正在研究 windows10
moc_SerialPortManager.cpp
#include <memory>
#include "../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp"
#include <QtCore/qbytearray.h> ...
日志
E:\Dokumenty\AiR_rok_4\S7\EngineeringThesis\AcornScanner\cm\cm-lib\build\windows\gcc\x64\debug.moc\moc_SerialPortManager.cpp:10: 错误: ../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp: 没有那个文件或目录
.......\AcornScanner\cm\cm-lib\build\windows\gcc\x64\debug.moc\moc_SerialPortManager.cpp:10:10: 致命错误:../../../../../..[=25= .hpp: 没有那个文件或目录
#include "../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
请注意,您的存储库布局与本地文件系统不同:
.../debug/.moc/
对比
.../debug.moc/
因此,相对路径上升一级过多,导致路径不存在。
通常认为将自动生成的文件(即 moc 文件)置于版本控制之下是不好的做法。我假设如果你删除整个 build
目录并重新构建你会没事的。
我正在尝试构建 qt 项目,但我不断收到有关 moc object moc_SerialPortManager.cpp 中不存在 header 的错误。我用 bash 移动到那个目录,并使用 cd cmd 和用 mock object 编写的路径,它会引导到正确的目录。有没有人知道如何解决它?在这一点上,这是一个相当大的项目,所以请告诉我我可以发布什么来让你更容易? 我在 git https://github.com/Orpiczy/AcornScanner/compare/fronAndBackJoin 上都有,如果你想查看
我正在使用适用于 C++ 和 Qt 6.2.0 的 Mingw 编译器 8.1.0 64 位,我正在研究 windows10
moc_SerialPortManager.cpp
#include <memory>
#include "../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp"
#include <QtCore/qbytearray.h> ...
日志 E:\Dokumenty\AiR_rok_4\S7\EngineeringThesis\AcornScanner\cm\cm-lib\build\windows\gcc\x64\debug.moc\moc_SerialPortManager.cpp:10: 错误: ../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp: 没有那个文件或目录 .......\AcornScanner\cm\cm-lib\build\windows\gcc\x64\debug.moc\moc_SerialPortManager.cpp:10:10: 致命错误:../../../../../..[=25= .hpp: 没有那个文件或目录 #include "../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
请注意,您的存储库布局与本地文件系统不同:
.../debug/.moc/
对比
.../debug.moc/
因此,相对路径上升一级过多,导致路径不存在。
通常认为将自动生成的文件(即 moc 文件)置于版本控制之下是不好的做法。我假设如果你删除整个 build
目录并重新构建你会没事的。