23. November 2013

Cppcheck – How to open source code at problematic line in Vim

Cppcheck is useful tool for assesment of C++ code quality. It can diagnose many potential problems.

It’s quite easy to configure Cppcheck to open files at problematic location in your favorite editor.

Here is example how to connect Cppcheck and Vim.

Open Edit – Preferences, select Applications tab, click Add

cppcheck-vim-01

Fill following form.

Name: gvim

Executable (point it to your installation of Vim): C:\Program Files (x86)\Vim\vim74\gvim.exe

Parameters: -f +(line) (file)

Click Ok.

cppcheck-vim-02

Set gvim as default application. Select gvim line and click Set as default.

cppcheck-vim-03

Double click any warning or error message and Vim should open at problematic line.

cppcheck-vim-04