有没有一种方法可以为Microsoft C ++编译器指定C ++兼容性级别? [英] Is there a way to specify C++ compatibility level for Microsoft C++ compiler?
问题描述
/ Tc
编译器选项仅求助于 C
,但是有什么方法可以指定确切的兼容性级别Microsoft C ++
编译器?像 C ++ 11
, C ++ 03
, C ++ 98
...
/Tc
compiler option resort only to C
, but is there any way to specify the exact compatibility level for the Microsoft C++
compiler? Like C++11
, C++03
, C++98
...
推荐答案
从Visual C ++ 2015 Update 3开始,现在可以为语言行为(显然,它不会仅影响一致性检查):
As of Visual C++ 2015 Update 3, it is now possible to specify a language version for language behavior (apparently it doesn't affect just conformance checking):
https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in -the-compiler /
不幸的是,唯一的选择是 C ++ 14(不完全是,它包括C ++ 14之后的功能以前的版本)和 C ++最新版本(C ++ 14加上C ++ 17和提案的部分实现,但没有实验性功能)。仍然没有启用/禁用早期版本的语言的选项(问题中提到的C ++ 98 / C ++ 03 / C ++ 11)
Unfortunately the only options are "C++14" (not exact, it includes post-C++14 features which had previously shipped) and "C++ Latest" (C++14 plus partial implementation of C++17 and proposals, but not "experimental" features). There still are no options for enabling/disabling earlier versions of the language (C++98 / C++03 / C++11 as mentioned in the question)
相应的命令行开关为:
-
/ std:c ++ 14
-
/ std:c ++ latest
/std:c++14
/std:c++latest
这篇关于有没有一种方法可以为Microsoft C ++编译器指定C ++兼容性级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!