📅 2015-Jun-11 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cpp, cppcheck, cppcheclipse, eclipse, eclipse cdt, plugin, static analysis ⬩ 📚 Archive
The biggest problem of C++ code is bugs. Bugs can slip through even when compiling code with all warnings turned on. A useful tool in the arsenal of a C++ programmer is CPPCheck, a static analysis tool. You are in luck if you are using Eclipse CDT because the CPPChEclipse plugin makes using CPPCheck with your C++ project very easy.
$ sudo apt install cppcheck
Install CPPChEclipse in Eclipse CDT by adding the URL http://cppcheclipse.eclipselabs.org.codespot.com/svn/update/ to Help -> Install New Software. Your Eclipse will restart after the installation.
Go to Window -> Preferences -> C/C++ -> CPPChEclipse. First, set the path of CPPCheck to /usr/bin/cppcheck
. In the Problems subsection, choose the types of problems you want to be reported about (warnings, errors, style problems). In the Settings subsection, choose the C and C++ standard versions you want to be applied. You can also indicate the CPPCheck use the include paths used by your project (this is very useful).
To run CPPCheck on a project, right-click on its name in the Project Explorer and choose CPPCheck -> Run CPPCheck. The default keyboard shortcut for this is Shift + Ctrl + C
. After CPPCheck runs, you can view the problems it has reported in the Problems view at the bottom of Eclipse.
Tried with: CPPCheck 1.61, CPPChEclipse 1.0.0, Eclipse 4.4.2 and Ubuntu 14.04