问题
I've started using Sublime Text 3 as my code editor for C++ and I installed some additional packages, two of which being SublimeLinter and SublimeLinter-contrib-clang. Everything seems to be working fine, except that it looks like there is no support for C++11 in the linter.
Do you know how I could change that to work with C++11?
回答1:
According to the SublimeLinter-contrib-clang troubleshooting guide, it can sometimes has issues finding the C++ standard library headers (see bullet 3). If that doesn't work or if you are not stuck using SublimeLinter-contrib-clang, consider using SublimeLinter-cpplint or SublimeLinter-cppcheck instead, as these are meant for C++11 development.
回答2:
For anybody with the same problem:
The solution is to go to Preferences -> Package Settings -> SulbimeLinter -> Settings Default.
There you need to paste the following:
"linters":
{
"clang": {
"extra_flags": "-std=c++11"
}
},
somewhere in the "default" namespace. At least that worked for me.
Cheers!
回答3:
Just in case someone is trying it for Sublime Version 3 and other answers are not helping; following worked for me.
It is also mentioned on the home site: https://github.com/SublimeLinter/SublimeLinter-clang
{
"linters":
{
"clang++": {
"args": "-Wall -fsyntax-only -fno-caret-diagnostics -std=c++11",
},
"clang": {
"args": "-Wall -fsyntax-only -fno-caret-diagnostics -std=c++11",
}
}
}
来源:https://stackoverflow.com/questions/42330415/sublimelinter-with-c11