C ++ 14支持在QtCreator与Clang [英] C++14 support in QtCreator with Clang

查看:1021
本文介绍了C ++ 14支持在QtCreator与Clang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Clang 3.5在QtCreator 3.3中启用C ++ 14支持?我添加了一个Clang工具包,我在我的项目文件中添加了 CONFIG + = c ++ 14 。然而,当使用例如。 退回类型扣除我收到以下错误:

How can I enable C++14 support in QtCreator 3.3 using Clang 3.5? I have added a Clang kit and I have added CONFIG += c++14 in my project file. However when using e.g. return type deduction I get the following error:


错误:'auto'返回没有结尾返回类型;推导出的返回类型是一个C ++ 1y扩展

error: 'auto' return without trailing return type; deduced return types are a C++1y extension


推荐答案

在构建文件夹中,并用 -std = c ++ 14 手动替换 -std = c ++ 11

I had to go to the Makefile in the build folder and manually replace -std=c++11 with -std=c++14.

幸运的是,当您将工具包添加到项目中时,Makefile只写一次。我只需要做这一次,并可以建立在QtCreator的频率,我想要的。

Thankfully the Makefile is only written once when you add the kit to the project. I only had to do this once and could build in QtCreator as often as I want.

现在我可以使用Clang工具包来使用所有新的c ++ 14功能。作为一个奖励,如果我在Makefile中手动设置 -std = c ++ 1z ,我也可以使用所有的c ++ 17功能。 Sweet!

So now I can use a Clang kit to use all the new c++14 features. As a bonus, I can also use all the c++17 features if I manually set -std=c++1z in the Makefile. Sweet!

这篇关于C ++ 14支持在QtCreator与Clang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆