NOTE: I recommend that you use the flycheck.
Because, you can run the checker more than one. Of course, including cppcheck
.
Cppcheck for Emacs with flymake-mode.
To use Cppcheck with Emacs, you will need Cppcheck installed.
You should be able to run
$ cppcheck
and, you'll also need to install flymake-easy.
You'll need to add the directory containing flymake-cppcheck.el
to your load-path
.
If not, also add to your config
(add-to-list 'load-path "~/.emacs.d/path/to/flymake-cppcheck.el")
(require 'flymake-cppcheck)
(add-hook 'c-mode-hook 'flymake-cppcheck-load)
(add-hook 'c++-mode-hook 'flymake-cppcheck-load)
By default only error
messages are shown.
Through the command more checks can be enabled.
(custom-set-variables
'(flymake-cppcheck-enable "all"))
multi:
(custom-set-variables
'(flymake-cppcheck-enable "warning,performance,information,style"))
- warning
- performance
- information
- style
- unusedFunction
- all
By default, the location of the cppcheck
command is searched.
(custom-set-variables
'(flymake-cppcheck-command "/path/to/cppcheck"))
one of 'tempdir or 'inplace (default).
(custom-set-variables
'(flymake-cppcheck-location 'tempdir))
Please refer to official document.