我正在使用SublimeLinter-clang
和Sublime 3
在MacOS Mojave上使用lint C++
代码。我收到来自更高版本的C++
的代码的警告和错误。如何将默认的linting版本设置为C++17
?
例如,我有这条线:
auto game = SpinOut{};
编辑器标记如下:
1 warning: clang++ - 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
clang++: error - expected '(' for function-style cast or type construction
我试着按照这个question的答案但没有改变。下面是我的SublimeLinter.sublime.settings
,我仍然得到相同的错误和警告。
SublimeLinter-clang现在维持在https://github.com/SublimeLinter/SublimeLinter-clang而不是https://github.com/nirm03/SublimeLinter-clang。
在较新版本中,2018年有一个pull请求,它增加了支持,使用户能够为c linter和c ++ linter提供不同的设置。因此2017年在https://stackoverflow.com/a/42818098/17034的答案目前已经过时。
所以看起来你需要改变clang到clang ++。看起来他们在设置中将extra_flags更改为args,因此您需要覆盖默认的args并添加-std = c ++ 11。
"linters":
{
"clang++": {
"args": "-Wall -fsyntax-only -fno-caret-diagnostics -std=c++11"
}
},