我最近开始使用 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/