ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter-clang

by SublimeLinter ST3

SublimeLinter plugin for C/C++, using clang

Details

Installs

  • Total 35K
  • Win 14K
  • OS X 9K
  • Linux 12K
Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10
Windows 5 12 13 9 10 19 15 3 3 21 16 9 10 5 9 11 7 3 9 10 17 6 4 14 17 13 13 12 12 7 15 14 16 9 8 10 12 15 16 12 16 22 6 12 14 18
OS X 4 2 8 6 3 4 7 7 3 6 7 10 2 9 2 2 4 3 5 4 6 3 6 7 4 8 8 7 4 6 8 9 7 5 6 6 4 8 8 6 11 6 5 8 7 5
Linux 2 6 8 7 7 6 6 5 11 8 10 17 10 9 10 7 7 6 19 6 14 7 10 9 9 8 7 13 11 12 16 8 13 6 10 7 11 9 11 8 12 15 14 12 8 17

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

Additional settings for SublimeLinter-clang:

Setting Description
include_dirs A list of directories to be added to the header search paths (-I is not needed).
extra_flags A string with extra flags to pass to clang. These should be used carefully, as they may cause linting to fail.

In project-specific settings, SublimeLinter allows expansion variables. For example, in project-specific settings, '${project_path}' can be used to specify a path relative to the project folder.

"SublimeLinter":
{
    "linters":
    {
        "clang": {
            "extra_flags": "-Wall -I${project_path}/foo",
            "include_dirs": [
                "${project_path}/3rdparty/bar/include",
                "${project_path}/3rdparty/baz"
            ]
        }
    }
},

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 “extra_flags”.