news 2026/6/11 20:13:22

【银河麒麟】【ARM64】解决银河麒麟桌面系统V10安装Qt Creator 提示 the code model could not parse an include file

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
【银河麒麟】【ARM64】解决银河麒麟桌面系统V10安装Qt Creator 提示 the code model could not parse an include file

故障环境

d2000平台
银河麒麟桌面操作系统v10

故障现象

apt安装了qt creator,可以正常创建,编译程序。但是打开源代码ide提示 the code model could not parse an include file
展开有提示:

cstddef:50:10: fatal error:'stddef.h'filenot found main.cpp:1:1: note:infileincluded from /home/yeqiang/CrashDemo/main.cpp:1: main.cpp:1:10: note:infileincluded from /home/yeqiang/CrashDemo/main.cpp:1: QCoreApplication:1:10: note:infileincluded from /usr/include/aarch64-linux-gnu/qt5/QtCore/QCoreApplication:1: qcoreapplication.h:43:10: note:infileincluded from /usr/include/aarch64-linux-gnu/qt5/QtCore/qcoreapplication.h:43: qglobal.h:46:12: note:infileincluded from /usr/include/aarch64-linux-gnu/qt5/QtCore/qglobal.h:46:

原因分析

这通常是Qt Creator内置的代码模型(ClangCodeModel) 无法找到系统头文件导致的,特别是ARM64(aarch64)架构下的常见问题。程序可以正常编译运行,说明开发环境和编译器本身是没问题的。

问题的核心是Qt Creator用于提供代码补全、语法高亮和分析的“代码模型”组件,它依赖的libclang库找不到GCC的头文件路径

Qt Creator的代码模型使用一个名为libclang的独立工具来分析代码,它独立于你用来编译项目的GCC/G++编译器。当libclang的配置或其所依赖的系统头文件不完整时,它就无法找到像stddef.h这样的标准头文件,从而在IDE中误报错误,但这完全不影响实际的编译过程

解决方案:安装系统缺失的开发包

# 安装C/C++基础开发包sudoaptinstallbuild-essential# 安装与Qt Creator兼容的libclang库sudoaptinstalllibclang-common-8-dev
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!