简体   繁体   English

如何在qt创建者中使用qt的clang 5?

[英]How to use clang 5 with qt in qt creator?

I've configured my locally installed version of clang 5. 我已经配置了本地安装的clang 5版本。

在此输入图像描述

and set up a kit with it 并用它设置一个工具包

在此输入图像描述

but when I do a build with it: 但是当我用它做构建时:

在此输入图像描述

it's clearly still using the system compiler for qmake, which causes a bunch of errors because my code requires C++17 support: 它显然仍在使用qmake的系统编译器,这会导致一堆错误,因为我的代码需要C ++ 17支持:

在此输入图像描述

How do I set what compiler qmake is using? 如何设置qmake使用的编译器?

Thank you. 谢谢。

You can do it in your pro file, directly: 您可以直接在pro文件中执行此操作:

QMAKE_CC = /path/to/the/c/compiler
QMAKE_CXX = /path/to/the/c++/compiler

but you'd be better specify the correct Qt mkspec in your kit, which could be something like linux-clang . 但是你最好在套件中指定正确的Qt mkspec ,这可能类似于linux-clang Check the mkspecs directory, see if in some of its subdirectories there is the right qmake.conf already, if not you can make a new subdirectory in mkspecs and a new configuration file inside it. 检查mkspecs目录,看看它的某些子目录中是否已经有正确的qmake.conf ,如果没有,你可以在mkspecs中创建一个新的子目录,并在其中创建一个新的配置文件。 The mkspecs directory should be in the path given by the terminal command mkspecs目录应该在terminal命令给出的路径中

qmake -query QT_INSTALL_ARCHDATA

Hope it helped. 希望它有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM