注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将会直接标记为Invalid。
描述问题
QT ui头文件报错,不识别引用的头文件。
期待的结果
ui文件中引用头文件
QWGraphicsView
QGraphicsView
qwgraphicsview.h
错误信息
xmake
[ 50%]: compiling.release main.cpp
[ 62%]: compiling.release mainwindow.cpp
[ 75%]: compiling.release qwgraphicsview.cpp
error: mainwindow.cpp
C:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\mainwindow.h(1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui\ui_mainwindow.h(20): fatal error C1083: 无法打开包括文件: “qwgraphicsview.h”: No such file or directory
xmake -rvD
[ 25%]: compiling.qt.ui mainwindow.ui
C:\Qt\6.0.0\msvc2019_64\bin\uic.exe mainwindow.ui -o build\.gens\samp8_4\windows\x64\release\rules\qt\ui\ui_mainwindow.h
checking for C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\cl.exe ... ok
checking for flags (-Ox -fp:fast) ... ok
> cl.exe "-Ox" "-fp:fast" "/EHsc"
checking for flags (-std:c++17) ... ok
> cl.exe "-std:c++17" "/EHsc"
checking for flags (-fPIC) ... no
> cl.exe "-fPIC" "/EHsc"
[ 37%]: compiling.qt.moc mainwindow.h
C:\Qt\6.0.0\msvc2019_64\bin\moc.exe -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -D_WINDOWS -IC:\Qt\6.0.0\msvc2019_64\include\QtGui -IC:\Qt\6.0.0\msvc2019_64\include\QtWidgets -IC:\Qt\6.0.0\msvc2019_64\include\QtCore -IC:/Qt/6.0.0/msvc2019_64/include -IC:\Qt\6.0.0\msvc2019_64\mkspecs\win32-msvc -IC:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui mainwindow.h -o build\.gens\samp8_4\windows\x64\release\rules\qt\moc\moc_mainwindow.cpp
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX64\\x64\\cl.exe" -c /EHsc -nologo -Ox -fp:fast -std:c++17 -IC:\Qt\6.0.0\msvc2019_64\include\QtGui -IC:\Qt\6.0.0\msvc2019_64\include\QtWidgets -IC:\Qt\6.0.0\msvc2019_64\include\QtCore -IC:\Qt\6.0.0\msvc2019_64\include -IC:\Qt\6.0.0\msvc2019_64\mkspecs\win32-msvc -IC:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -D_WINDOWS -Fobuild\.objs\samp8_4\windows\x64\release\gens\rules\qt\moc\moc_mainwindow.cpp.obj build\.gens\samp8_4\windows\x64\release\rules\qt\moc\moc_mainwindow.cpp
checking for flags (cl_sourceDependencies) ... ok
> cl.exe "/sourceDependencies" "C:\Users\songh\AppData\Local\Temp\.xmake\210107\_269C5BAB9173486083F01F523E647960.json" "/EHsc"
C:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\moc\../../../../../../../../../mainwindow.h(1): warning C4819: 该文件包含不能在当前代码 页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
checking for ccache ... no
[ 50%]: compiling.release main.cpp
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX64\\x64\\cl.exe" -c /EHsc -nologo -Ox -fp:fast -std:c++17 -IC:\Qt\6.0.0\msvc2019_64\include\QtGui -IC:\Qt\6.0.0\msvc2019_64\include\QtWidgets -IC:\Qt\6.0.0\msvc2019_64\include\QtCore -IC:\Qt\6.0.0\msvc2019_64\include -IC:\Qt\6.0.0\msvc2019_64\mkspecs\win32-msvc -IC:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -D_WINDOWS -Fobuild\.objs\samp8_4\windows\x64\release\main.cpp.obj main.cpp
[ 62%]: compiling.release mainwindow.cpp
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX64\\x64\\cl.exe" -c /EHsc -nologo -Ox -fp:fast -std:c++17 -IC:\Qt\6.0.0\msvc2019_64\include\QtGui -IC:\Qt\6.0.0\msvc2019_64\include\QtWidgets -IC:\Qt\6.0.0\msvc2019_64\include\QtCore -IC:\Qt\6.0.0\msvc2019_64\include -IC:\Qt\6.0.0\msvc2019_64\mkspecs\win32-msvc -IC:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -D_WINDOWS -Fobuild\.objs\samp8_4\windows\x64\release\mainwindow.cpp.obj mainwindow.cpp
[ 75%]: compiling.release qwgraphicsview.cpp
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX64\\x64\\cl.exe" -c /EHsc -nologo -Ox -fp:fast -std:c++17 -IC:\Qt\6.0.0\msvc2019_64\include\QtGui -IC:\Qt\6.0.0\msvc2019_64\include\QtWidgets -IC:\Qt\6.0.0\msvc2019_64\include\QtCore -IC:\Qt\6.0.0\msvc2019_64\include -IC:\Qt\6.0.0\msvc2019_64\mkspecs\win32-msvc -IC:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui -DQT_NO_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -D_WINDOWS -Fobuild\.objs\samp8_4\windows\x64\release\qwgraphicsview.cpp.obj qwgraphicsview.cpp
error: @programdir\modules\private\async\runjobs.lua:210: @programdir\modules\private\action\build\object.lua:78: @programdir\modules\core\tools\cl.lua:453: mainwindow.cpp
C:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\mainwindow.h(1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\qtCode\Qt5d9CppDevGuide\samp8_4GraphicsCooridate\build\.gens\samp8_4\windows\x64\release\rules\qt\ui\ui_mainwindow.h(20): fatal error C1083: 无法打开包括文件: “qwgraphicsview.h”: No such file or directory
stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:789]: in function 'raise'
[@programdir\modules\core\tools\cl.lua:453]: in function 'catch'
[@programdir\core\sandbox\modules\try.lua:127]: in function 'try'
[@programdir\modules\core\tools\cl.lua:407]:
[C]: in function 'compile'
[@programdir\modules\private\action\build\object.lua:78]: in function 'script'
[@programdir\modules\private\action\build\object.lua:91]: in function '_build_object'
[@programdir\modules\private\action\build\object.lua:116]: in function 'jobfunc'
[@programdir\modules\private\async\runjobs.lua:188]:
[C]: in function 'trycall'
[@programdir\core\sandbox\modules\try.lua:121]: in function 'try'
[@programdir\modules\private\async\runjobs.lua:182]: in function 'cotask'
[@programdir\core\base\scheduler.lua:317]:
stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:789: in function 'raise'
@programdir\modules\private\async\runjobs.lua:210: in function 'catch'
@programdir\core\sandbox\modules\try.lua:127: in function 'try'
@programdir\modules\private\async\runjobs.lua:182: in function 'cotask'
@programdir\core\base\scheduler.lua:317: in function
warning: add_cxflags("-fPIC") is ignored, please pass `{force = true}` or call `set_policy("check.auto_ignore_flags", false)` if you want to set it.
如果是xmake相关编译问题,请加上-vD参数运行,并给出详细编译输出信息。
相关环境
请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:
xmake版本:2.3.9
xmake运行平台:win10
xmake目标平台:win10
其他信息
请提供其他附加信息帮助我们诊断问题(比如截图,xmake.lua或者可复现的demo),以及你遇到的问题的一些背景信息。