One thing you might also want to consider mentioning in the article is that there are two ways to run CppCheck, either without symbols/includes (as you have here) or with symbols and includes. Incidentally although most of our customers are using PC-lint rather than CppCheck we could always do with more Visual Lint + CppCheck beta testers (if you're interested please feel free to drop me a line). I'll declare an interest right now as I'm the original author of Visual Lint. I particularly like the File|Save macro idea, though that is obviously not viable in Visual Studio 2012 as the Macros IDE has been removed in that version of Visual Studio. Insert the following code in the module:Ī simple, concise & well illustrated article.In the Project Explorer panel, double click on EnvironmentEvents module.On the left hand side there should be a Project Explorer panel.Go to menu Tools →Macros →Macros IDE, this will bring up a the Macros IDE.Now that we have created a command to run Cppcheck, we can have it run automatically after a file save: The cool thing about the -template=vs switch is that you can click on a Cppcheck error and Visual Studio will automatically take you to that line of code: You can now use select the Cppcheck menu entry any time you want to run Cppcheck on a file. Voila! You now have a Cppcheck entry in your Tools menu: Click on the Move Up button repeatedly until your entry is at the top of the list, this will make it easier to identify you new command as you can count on it being called Tools.ExternalCommand1.Make sure Use Output window checkbox is enabled.Set Arguments to -quiet -verbose -template=vs $(ItemPath). Set Command to C:\Program Files (x86)\Cppcheck\cppcheck.exe.In Visual Studio, open menu Tools→External Tools. Getting Startedįirst things first, download the latest version Cppcheck from and install it. This will give you both the command line version and the GUI version of Cppcheck. If you want a more convenient way to run Cppcheck on your code, but don't want to shell out $200 for the privilege, there's a fairly easy way to do a simple integration. The problem is that if you use Visual Studio, you either have to use the separate Cppcheck GUI or pay an arm and a leg for something like Visual Lint. Anything that helps me avoid stupid mistakes is very welcome. Cppcheck is a good tool to have in your arsenal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |