默认 C++ 版本 SublimeLinter
Default C++ version SublimeLinter
我正在使用 SublimeLinter-clang
和 Sublime 3
来检查 MacOS Mojave 上的 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
我尝试按照此 的答案进行操作,但没有任何改变。下面是我的SublimeLinter.sublime.settings
,我仍然得到同样的错误和警告。
SublimeLinter-clang 现在维护在 https://github.com/SublimeLinter/SublimeLinter-clang rather than https://github.com/nirm03/SublimeLinter-clang。
在较新的版本中,2018 年有一个拉取请求,增加了支持,使用户能够对 c linter 和 c++ linter 进行不同的设置。因此 中 2017 年的答案目前已过时。
看来您需要将 clang 更改为 clang++。看起来他们在设置中将 extra_flags 更改为 args,因此您需要覆盖默认 args 并添加 -std=c++11。
"linters":
{
"clang++": {
"args": "-Wall -fsyntax-only -fno-caret-diagnostics -std=c++11"
}
},
我正在使用 SublimeLinter-clang
和 Sublime 3
来检查 MacOS Mojave 上的 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
我尝试按照此 SublimeLinter.sublime.settings
,我仍然得到同样的错误和警告。
SublimeLinter-clang 现在维护在 https://github.com/SublimeLinter/SublimeLinter-clang rather than https://github.com/nirm03/SublimeLinter-clang。
在较新的版本中,2018 年有一个拉取请求,增加了支持,使用户能够对 c linter 和 c++ linter 进行不同的设置。因此
看来您需要将 clang 更改为 clang++。看起来他们在设置中将 extra_flags 更改为 args,因此您需要覆盖默认 args 并添加 -std=c++11。
"linters":
{
"clang++": {
"args": "-Wall -fsyntax-only -fno-caret-diagnostics -std=c++11"
}
},