Pages

Sunday, November 1, 2015

How to integrate Cppcheck with Microsoft Visual Studio


  1. Download the latest version of Cppcheck from here.
  2. Open Microsoft Visual Studio IDE.
  3. In Visual Studio, open menu Tools -> External Tools.... The External Tools window will appear.
  4. Click Add button.
  5. Set Title field as Cppcheck (This can be set to any value).
  6. Set Command field to the path to cppcheck.exe (The ... button pops an Open File dialog box to select the required file).
  7. Set Arguments field to the parameters passed to cppcheck.exe (--verbose --enable=all --template=vs *.cpp *.h *.c).
    --verbose: Output more detailed error information.
    --enable=all : Enable all messages including errors, warnings, performance messages, information messages, unused function checks, style messages.
    --template=vs : Show the output in Visual Studio compatible format.
    For extended list of arguments supported by Cppcheck, refer user manual available here.
  8. Set Initial directory to $(ItemDir).
  9. Check Use Output window to redirect the Cppcheck outputs to the Visual Studio Output window.
  10. Click OKCppcheck should appear on the Tools menu.

To use Cppcheck, select Cppcheck menu entry on Tools menu.

1 comment: