如何使用ClangCodeModel插件在QtCreator中设置C ++标准? [英] How to set C++ standard in QtCreator with ClangCodeModel plugin?

查看:761
本文介绍了如何使用ClangCodeModel插件在QtCreator中设置C ++标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,如果这是一个愚蠢的问题,但是我已经尝试了几乎所有内容,现在就把头撞在墙上.

Sorry if this is a dumb question, but I have already tried almost everything and am banging my head against a wall right now..

问题是,带有Clang Code Model插件的Windows版QtCreator 4.8.0-beta解析了我的项目 作为C ++ 98,而实际上它是C ++ 17.但是,不允许在设置对话框中明确指定标准版本(选项"-std = c ++ 17"无效).

The problem is, QtCreator 4.8.0-beta for Windows with Clang Code Model plugin parses my project as C++98 whereas in fact it is C++17. However specifying the standard version explicitly in the settings dialog is not allowed ("Option "-std=c++17" is invalid").

那么,我如何告诉ClangCodeModel它应该将代码解析为C ++ 17? 我使用CMake构建项目,并且在顶层CMakeLists.txt文件中包含set (CMAKE_CXX_STANDARD 17).

So, how do I tell ClangCodeModel that it should parse code as C++17? I use CMake for building the project and have set (CMAKE_CXX_STANDARD 17) in the top-level CMakeLists.txt file.

谢谢!

推荐答案

我认为您的问题与 这个,根据日期为2018年10月的链接,这是QtCreator的问题,似乎尚未解决.但是,我建议您测试自己在链接中提出的解决方案,实际上它可以在您的PC上运行. 如果仍然遇到此问题,请尝试安装最新版本的Qt 5

I think your question is similar to This one, According to the link, dated October 2018, it is an issue of QtCreator and does not seem to have been solved. However I would suggest you to test yourself the solution proposed in the link, infact it may work on your pc. If you are still stuck into this problem, try to install the latest version of Qt 5

这篇关于如何使用ClangCodeModel插件在QtCreator中设置C ++标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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