我已经从Ubuntu18.04升级到20.04,除了一些讨厌的grub问题之外,大多数事情都是凭空捏造的。但是,我的QtCreator (Qt Creator 4.11.0, Based on Qt 5.12.8 (GCC 9.3.0, 64 bit))在识别包含的库时遇到了问题。它显示了数千条错误信息,这些信息在更新之前已经非常好地工作了。这些错误消息看起来都像链接器错误消息。下面是一些例子:
error: 'std::string' (aka 'int') is not a class, namespace, or enumeration
error: no matching function for call to 'getline'
error: member reference base type 'std::ifstream' (aka 'int') is not a structure or union
error: no template named 'vector' in namespace 'std'
error: unknown type name 'SystemCallFactory' //this class is from the same project甚至qt和std库中的一些错误:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1374: passing argument to parameter 's' here
/usr/include/c++/8/ostream:41: candidate found by name lookup is 'std'当我在QtCreator中创建一个新项目而不更改默认代码时,情况是一样的:
/home/$me/src/untitled/main.cpp:7: error: variable has incomplete type 'QApplication'`
/home/$me/src/untitled/main.cpp:8: error: unknown type name 'MainWindow'已安装的编译器:
更新-选项-显示gcc gcc -自动模式链接最佳版本是/usr/bin/nan-8链接当前指向/usr/bin/-8链接is /usr/bin/usr/bin/-8-优先级30 /usr/bin/-9-优先级20更新-选项-显示g++ g++ -自动模式链接最佳版本为/usr/bin/ g++ -8链接当前指向/usr/bin/g+-8链接g++ is/usr/bin/g++ /usr/bin/g++-8 -优先级30 /usr/bin/g+-9-优先级20
I仍然可以手动构建所有项目,同样,这里的cmake和qmake都是工作的。而且,当我在QtCreator中设置的build目录中有一个完整的构建时,QtCreator将构建我的项目,即使我做了一些更改。它仍然会在我的代码和issues部分中显示错误,但无论如何都会生成和运行,所以构建命令应该是可以的。但是,当构建目录为空时,它将失败。我如何进一步处理这个问题?
发布于 2020-05-11 15:39:17
这里同样的问题,和@nou一样的解决方案。QtCreator 4.11仍然依赖clang-8,但是Ubuntu20.04APT将安装clang-10。以下为我解决了这个问题:
安装clang 8
sudo apt install clang-8更新备选方案
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100我不需要重新安装QtCreator。
发布于 2020-05-10 22:05:25
我不是百分之百肯定这是同样的问题,但我解决了它通过安装clang-8软件包。我认为问题在于,by创建者代码模型插件使用libclang1-8,但clang-10默认安装。
发布于 2021-06-24 22:21:37
Qt 4.15.1似乎与其默认配置的工具包再次发生冲突。
所以我做了一个定制的:
使用此工具包,cmake和Qmake正在工作,并且缺少stl和std路径是固定的。

https://askubuntu.com/questions/1232969
复制相似问题