- Download the latest version of Cppcheck from here.
- Open Microsoft Visual Studio IDE.
- In Visual Studio, open menu Tools -> External Tools.... The External Tools window will appear.
- Click Add button.
- Set Title field as Cppcheck (This can be set to any value).
- Set Command field to the path to cppcheck.exe (The ... button pops an Open File dialog box to select the required file).
- 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. - Set Initial directory to $(ItemDir).
- Check Use Output window to redirect the Cppcheck outputs to the Visual Studio Output window.
- Click OK. Cppcheck should appear on the Tools menu.
To use Cppcheck, select Cppcheck menu entry on Tools menu.
very useful. Thanks a lot for this.
ReplyDelete