CPPLint is a tool created by Google that can be used to check a C++ source or header file. It is a single file Python script. It would be nice to apply CPPLint on a C++ file in Eclipse CDT whenever it is saved. This is possible by using the CPPStyle plugin for Eclipse. It runs
cpplint.py on a saved C++ file and displays the reported errors conveniently in a Problems view, as shown in screenshot above.
- First install CPPLint:
$ sudo curl -L "http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py" -o /usr/bin/cpplint.py $ sudo chmod a+x /usr/bin/cpplint.py
- Install CPPStyle plugin in Eclipse. Open Help -> Install New Software and the URL
http://wangzw.github.io/CppStyle/updateto install it. Eclipse will be restarted after that.
Open Window -> Preferences -> C/C++ -> CPPStyle. Enable the
Enable cpplint on saveoption.
Edit and save any C++ file. CPPLint will be run on it. If there are any problems, you can see the output in Console view or see them listed nicely in Problems view.
Tried with: CPPStyle 1.0.0 and Eclipse Luna 4.4.1