在 Qt 上使用 CMake 配置 VSCode - 找不到 ui_*.h 文件
Configuring VSCode with CMake on Qt - ui_*.h files can't be found
我正在尝试使用Microsoft C/C IntelliSense扩展名配置VSCODE以使用C 和QT进行的项目运行。
某些文件包括QT UI标题,格式:
#include "ui_filename.h"
然而,这些是用红色的痕迹和消息强调的:
#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit (/path/to/my/workspace).
cannot open source file "ui_filename.h"
这些文件位于目录build.debug/
中,该目录是我的根工作区目录的子目录。
我尝试使用CMAKE工具扩展名,仅使用以下方式进行配置:
"cmake.copyCompileCommands": "build/compile_commands.json"
build
是项目目录,用于与构建有关的所有事情。
C/C 扩展的配置具有以下相关行:
"includePath": [
"${workspaceFolder}/**",
"/usr/include/x86_64-linux-gnu/qt5/**"
],
...
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
但是,这仍然无法解决问题。我还尝试过安装CMAKE工具助手扩展程序,具有讽刺意味的是无济于事。
我不确定从这里去哪里。其他一切正常,QT定义都已识别,并且所有正常的标题都识别出来。我已经检查过,并且我的工作区中肯定存在UI标头文件。我能做些什么?非常感谢帮助。
看来,您似乎必须手动将文件路径添加到项目包含路径中。在此处查看手册部分以获取更多信息。
相关文章:
- std::map<struct,struct>::find 找不到匹配项,但是如果我循环通过 begin() 到 end(),我在那里看到匹配项
- 找不到成员对象:没有名为get_event()的成员,也处理多态性和向量
- 为什么野牛仍在使用"int yylex(void)",却找不到"int yylex(YYS
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 奇怪的(对我来说)返回声明 - 在谷歌上找不到任何关于它的信息
- 找不到QtResource文件中的文件
- VC++本机单元测试,找不到调试符号
- RegGetValue在当前用户下找不到名称
- 带有 -stdlib=libc++ 的 clang++ 9.0.1 找不到<optional>
- c++找不到具有相同哈希的无序集合元素
- 找不到以下加速库:boost_fiber
- 找不到 FLTK(缺少:FLTK_INCLUDE_DIR)
- 设置 Visual Studio for MPI: 找不到标识符错误
- "assimp/config.h"找不到,但它在文件夹中
- 链接器找不到在虚拟类 c++ 中访问的静态字段的符号
- C++系统找不到指定的文件错误
- FindPackageHandleStandardArgs.cmake:137 的 CMake 错误(消息):找不到 Boost (缺少:正则表达式)(找到合适的版本"1.72.0",
- vcpkg 添加新库,但找不到
- CMake + Qt,moc 编译失败,无法实现 QMetaObject 方法(编译器找不到基本 ui 对象的标头?
- UI::主窗口找不到成员