qt - 在 Ubuntu 16.04 上配置 Qt 5.9.5

标签 qt ubuntu g++

我最近开始使用 Qt。我正在尝试一些简单的小部件。它按预期工作,没有错误,突然 Qt 不再工作了。我没有更改任何配置/设置。我重新启动了计算机,然后开始出现以下错误。我不知道如何修复它们。

错误(尝试打开一个已经存在的项目时):

/Qt/5.9.5/gcc_64/mkspecs/features/qmake_use.prf(6): 'take_first' is not a recognized replace function.
Project ERROR: Library '' is not defined.
Warnings while parsing QML type information of Qt/5.9.5/gcc_64/qml:
/Qt/5.9.5/gcc_64/qml/builtins.qmltypes:1:24: Reading only version 1.1 parts.
/Qt/5.9.5/gcc_64/qml/builtins.qmltypes:10:5: Expected only Component and ModuleApi object definitions.
/Qt/5.9.5/gcc_64/mkspecs/features/qmake_use.prf(6): 'take_first' is not a recognized replace function.
Project ERROR: Library '' is not defined.
/Qt/5.9.5/gcc_64/mkspecs/features/toolchain.prf(69): system(execute) requires one or two arguments.
Project ERROR: Cannot run compiler 'g++'. Output:
===================
===================

错误(尝试创建新项目时)

 Maybe you forgot to setup the environment?
Error while parsing file /workspace/testQt/testQt.pro. Giving up.
/Qt/5.9.5/gcc_64/mkspecs/features/toolchain.prf(69): system(execute) requires one or two arguments.
Project ERROR: Cannot run compiler 'g++'. Output:
===================
===================

其他细节:

Qt version: Qt 5.9.5(gcc_64)
Compilier: GCC 7.3.0
OS: Ubuntu 16.04.4 LTS

PS:两天前我遇到了同样的错误。重新安装 Qt 修复了它,但现在不行了。

g++没有问题。我通过终端使用相同的编译器(此处使用)编写了代码,并且运行良好。

谢谢。

最佳答案

我遇到了同样的问题,升级QtCreator解决了。我认为,QtCreator 的 3.x.x 版本错误地假定了 g++ 编译器的名称。在 Kits 选项中只有“Compiler”设置,而在 4.x.x 中有两个单独的字符串“C”和“C++”。在指示两个编译的正确路径后,“无法运行编译器”错误消失。

关于qt - 在 Ubuntu 16.04 上配置 Qt 5.9.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50490781/

相关文章:

c++ - 如何让我的应用程序使用错误的 dll?

c++ - 在 Qt 中移动 Snake 时遇到问题

python - 通过 SSH 查看脚本输出?

user-interface - 如何在 Amazon AWS 中将 ubuntu 服务器升级到桌面?

c++ - 实际长 double 与 std::numeric_limits 不一致

c - 有关 "-Wl,-rpath=."的信息

c++ - libuvc 和 opencv2 的 G++ undefined reference

c++ - 使用 QXmlItem 作为 QXmlQuery 焦点提取子节点值

c++ - 如何覆盖自定义委托(delegate)类的 'paint'函数来绘制QSpinBox

git - 可以将 repo 克隆到 Docker 容器吗?