AutoUIC 在处理之前忽略“未找到 ui 文件”

问题描述 投票:0回答:0

我有一个看起来像这样的文件:

    ...

    #ifdef IS_COMPILE_FOR_SPECIAL_TARGET
        #include "ui_myPage_special.h"
    #else
        #include "ui_myPage.h"
    #endif

项目使用AutoUIC包含

ui_
文件。但是由于 AutoUIC 在预处理器之前被调用,它忽略了我的
#ifdef
声明并尝试替换
ui_myPage_special.h
尽管
.ui
在这个项目中不存在。

错误信息 :

AutoUic error
-------------
"SRC:/path/to/mySource.cpp"
includes the uic file "ui_myPage_special.h",
but the user interface file "myPage_special.ui"
could not be found in the following directories
...

我寻找的解决方案是,如果 AutoUIC 可以,以防它找不到文件,将

#include
替换为
#error
或保持原样。所以是预处理器会引发错误,而不是 AutoUIC。

我试图找到是否存在像这样的autouic-option,但我没有在 CMake 文档中找到它。

c++ qt cmake c-preprocessor automoc
© www.soinside.com 2019 - 2024. All rights reserved.