文章目录

问题描述

环境:
ubuntu 18.04 LTS
Qt creator 4.11.0

遇到个小bug,简单记录一下。
直接在github上clone下来的包,可正常编译运行,但Qt显示很多报错,如下所示:
在这里插入图片描述
例如:

...
/home/xuuyann/ruckig/examples/2_position_offline.cpp:7: error: expected namespace name
/home/xuuyann/ruckig/examples/2_position_offline.cpp:35: error: no member named 'cout' in namespace 'std'
/home/xuuyann/ruckig/examples/2_position_offline.cpp:45: error: expected '(' for function-style cast or type construction
/home/xuuyann/ruckig/examples/2_position_offline.cpp:52: error: no member named 'cout' in namespace 'std'
...

虽然说可以运行没有问题,但这么多错误看着碍眼,且不便于调试,故找办法解决。

解决方法

错误报告及解决链接:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=952718

安装 ‘qtcreator’ 但不安装 ‘libclang-common-8-dev’ 软件包。
注意:安装“clang”软件包将安装“clang-9”而不是“clang-8”。
在 qtcreator 中打开 CMake 项目时,它执行“#include‘,则 ‘cstddef’ 中的 clang 代码模型报告错误:‘CSTDDEF:50:10:致命错误:找不到’stddef.h’ 文件’

– System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (500, ‘unstable’)
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.4.8-amdnoflr-20200109 (SMP w/12 CPU cores)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
LANGUAGE=fr (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages qtcreator depends on:
ii libc6 2.29-10
ii libclang1-8 1:8.0.1-7
ii libgcc-s1 [libgcc1] 10-20200222-1
ii libgcc1 1:10-20200222-1
ii libkf5syntaxhighlighting5 5.62.0-3
ii libllvm8 1:8.0.1-7
ii libqbscore1.13 1.13.1-2
ii libqt5concurrent5 5.12.5+dfsg-8
ii libqt5core5a [qtbase-abi-5-12-5] 5.12.5+dfsg-8
ii libqt5designer5 5.12.5-2+b2
ii libqt5designercomponents5 5.12.5-2+b2
ii libqt5gui5 5.12.5+dfsg-8
ii libqt5help5 5.12.5-2+b2
ii libqt5network5 5.12.5+dfsg-8
ii libqt5printsupport5 5.12.5+dfsg-8
ii libqt5qml5 [qtdeclarative-abi-5-12-5] 5.12.5-5
ii libqt5quick5 5.12.5-5
ii libqt5quickwidgets5 5.12.5-5
ii libqt5script5 5.12.5+dfsg-2
ii libqt5serialport5 5.12.5-1
ii libqt5sql5 5.12.5+dfsg-8
ii libqt5sql5-sqlite 5.12.5+dfsg-8
ii libqt5widgets5 5.12.5+dfsg-8
ii libqt5xml5 5.12.5+dfsg-8
ii libstdc++6 10-20200222-1
ii qml-module-qtqml-models2 5.12.5-5
ii qml-module-qtquick-controls 5.12.5-1+b1
ii qml-module-qtquick2 5.12.5-5
ii qtchooser 66-2
ii qtcreator-data 4.11.0-2
Versions of packages qtcreator recommends:
ii clang 1:9.0-49
ii clang-tidy 1:9.0-49
ii gdb-minimal [gdb] 9.1-1
ii konsole [x-terminal-emulator] 4:19.08.1-2+b1
ii make 4.2.1-1.2
pn qmlscene
pn qt5-doc
pn qt5-qmltooling-plugins
pn qtbase5-dev-tools
pn qtcreator-doc
pn qtdeclarative5-dev-tools
pn qttools5-dev-tools
pn qttranslations5-l10n
pn qtxmlpatterns5-dev-tools
Versions of packages qtcreator suggests:
pn clazy
ii cmake 3.16.3-1
ii g++ 4:9.2.1-3.1
ii git 1:2.25.1-1
pn kate-data
pn subversion
ii valgrind 1:3.15.0-1
Versions of libclang-common-8-dev that fix the issue:
libclang-common-8-dev 1:8.0.1-7

查找已安装的程序包:
xuuyann@ubuntu:~$ sudo apt list --installed
在这里插入图片描述
根据关键词查找
xuuyann@ubuntu:~$ dpkg -l | grep 'libclang'
在这里插入图片描述
发现没有错误报告中要求的包,故安装之。
xuuyann@ubuntu:~$ sudo apt-get install libclang-common-8-dev
重启Qt后问题解决。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐