我正在嘗試構建 qt 專案,但我不斷收到關于 moc 物件 moc_SerialPortManager.cpp 中沒有現有標頭的錯誤。我用 bash 移動到那個目錄,并使用 cd cmd 和寫在模擬物件中的路徑,它會導致正確的目錄。有沒有人知道如何解決它?在這一點上,這是一個相當大的專案,所以請告訴我我可以發布什么來讓您更輕松?如果你想查看它,我在 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:致命錯誤:../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp:否這樣的檔案或目錄#include "../../../../../../source/controllers/LowLevelFunctionality/DeviceController/ProfilometerManager/SerialPortManager.hpp" ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
uj5u.com熱心網友回復:
請注意,存盤庫的布局與本地檔案系統不同:
.../debug/.moc/
對比
.../debug.moc/
因此,相對路徑過多地上升一級并導致不存在的路徑。
將自動生成的檔案(即 moc 檔案)置于版本控制之下通常被認為是不好的做法。我假設如果你洗掉整個build目錄并重新構建你會沒事的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/379726.html
