Reputation: 39
I am using SublimeLinter-clang
with Sublime 3
to lint C++
code on MacOS Mojave. I am getting warnings and errors for code from later versions of C++
. How do I set the default linting version to C++17
?
For instance, I have the line:
auto game = SpinOut{};
and the editor marks the following:
1 warning: clang++ - 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
clang++: error - expected '(' for function-style cast or type construction
I tried following the answer to this question but nothing changed. Below is my SublimeLinter.sublime.settings
, and I still get the same error and warning.
Upvotes: 1
Views: 437
Reputation: 1224
SublimeLinter-clang is now maintained at https://github.com/SublimeLinter/SublimeLinter-clang rather than https://github.com/nirm03/SublimeLinter-clang.
In the newer version there was a pull request in 2018 that added support that gives users the ability to have different settings for the c linter and c++ linter. So the answer from 2017 in https://stackoverflow.com/a/42818098/17034 is currently outdated.
So it looks like you will need to change clang to clang++. It also looks like they changed extra_flags to args in the settings, so you will need to override the default args and add -std=c++11.
"linters":
{
"clang++": {
"args": "-Wall -fsyntax-only -fno-caret-diagnostics -std=c++11"
}
},
Upvotes: 4