SublimeLinter-clang
SublimeLinter plugin for C/C++, using clang
Details
Installs
- Total 58K
- Win 24K
- Mac 14K
- Linux 20K
Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 3 | 3 | 1 | 2 | 1 | 2 | 0 | 3 | 6 | 1 | 3 | 1 | 1 | 1 | 6 | 3 | 1 | 2 | 3 | 3 | 5 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 5 | 4 | 6 | 2 | 0 | 7 | 2 | 2 | 3 | 0 | 0 | 2 | 1 | 3 | 6 | 0 | 8 | 6 |
Mac | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 2 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
Linux | 1 | 1 | 2 | 0 | 0 | 3 | 4 | 3 | 1 | 1 | 5 | 1 | 0 | 3 | 1 | 1 | 0 | 2 | 3 | 3 | 3 | 1 | 2 | 0 | 0 | 0 | 0 | 1 | 3 | 0 | 4 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 3 | 0 | 0 | 1 | 7 |
Readme
- Source
- raw.githubusercontent.com
SublimeLinter-clang
This linter plugin for SublimeLinter provides an interface to clang. It will be used with files that have the C/C Improved/C++ syntax.
Installation
SublimeLinter must be installed in order to use this plugin.
Please use Package Control to install the linter plugin.
Before using this plugin, ensure that clang
is installed on your system.
- Mac OS X: clang should be already bundled.
- Linux: clang can be easily installed using most package managers.
- Windows: the situation is a little trickier, especially with C++. One way to go is to install mingw with clang. Both gcc and clang packages should be installed into the same directory.
Once clang
is installed, ensure it is in your system PATH so that SublimeLinter can find it.
The docs cover troubleshooting PATH configuration
Settings
We have two settings sections. 'clang' for c files, and 'clang++' to configure the linter for c++ files. E.g.
{
"linters":
{
"clang": {
"args": "-fvery-important",
"I": [
"${folder}/3rdparty/bar/include",
"${folder}/3rdparty/baz"
]
},
"clang++": {
"args": "-falso-important"
}
}
},
Note: 'args' has the default value '-Wall -fsyntax-only -fno-caret-diagnostics', so make sure to include them when overriding 'args'.
All common settings information can be found here:
- SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html
- Linter settings: http://sublimelinter.com/en/latest/linter_settings.html
Additional settings for SublimeLinter-clang:
Setting | Description |
---|---|
I | A list of directories to be added to the header search paths. |
isystem | A list of directories to be added to the system header search paths. |
x | Automatically set depending on the file type. |
SublimeLinter allows expansion variables. For example, '${folder}' can be used to specify a path relative to the project folder.
Troubleshooting
C/C++ linting is not always straightforward. A few things to try when there's (almost) no linting information available:
- Try to compile from the command line, and verify it works.
- The linter might be missing some header files. They can be added with “include_dirs”.
- Sometimes clang fails to locate the C++ standard library headers.
Assuming the compilation works when executed via command line, try to compile with clang++ -v
.
This will display all of the hidden flags clang uses. As a last resort, they can all be added as “args”.