Troubleshooting

Answers to common questions and problems.

I get many "Include file not found" messages

There are two kinds:

Use Analyze > Check configuration (defines, includes) to get a list of the configuration problems of the project.

Cppcheck reports a syntax error or an unknown macro

Cppcheck does not analyze a file it can not parse. A message like There is an unknown macro here somewhere. Configuration is required. means that the code uses a macro that Cppcheck does not know, in a place where the code can not be parsed without knowing what the macro means. For example:

DECLARE_HANDLER(foo)    // what is this?
{
    ...
}

To fix it, do one of these:

If the code is correct and compiles, but Cppcheck still reports a syntax error, please report it as a Cppcheck bug.

The analysis is slow

A warning is wrong (false positive)

First check the configuration: missing include paths and missing library configurations are common causes. For example, if your code calls a function that never returns and Cppcheck does not know that, it can report problems in code that is never reached. Configure the function as noreturn in a library configuration (see Library editor).

If the configuration is right, suppress the warning (see Hiding and suppressing warnings) and please report the false positive to the Cppcheck project with a small code example. Use the scratchpad to make the example as small as possible.

A bug that I know of is not found

Cppcheck can not find all bugs. If you think the bug should be found, create a small example in the scratchpad and report it to the Cppcheck project.

Checking the library configuration

Select Analyze > Reanalyze and check library. The project is analyzed again, and Cppcheck reports information messages for functions it has no configuration for, for example:

Write the missing configuration in a .cfg file with the library editor or a text editor, put it in the folder of the project file and select it on the Types and Functions tab of the project.

Addons do not work

Clang-Tidy is "not found"

Install Clang-Tidy (it is part of LLVM/Clang). If it is not in the PATH, set the Clang path in the preferences to the folder where clang-tidy is.

Double-clicking a warning does nothing

No editor is configured, or no default editor is selected. Add your editor on the Applications tab of the preferences and click Set as default. If the editor does not start, check the executable path and the parameters.

The results are old

When you open a project with a build dir, the results of the last analysis are shown, not a new analysis. Click Reanalyze all files to analyze the current code.

"Failed to load std.cfg"

The GUI can not find its data files. The Cppcheck installation is broken; reinstall Cppcheck. If you built Cppcheck yourself, make sure the cfg folder is installed next to the program, or configure the data folder with the --data-dir command line option.

Where can I get more help?