OnWorks favicon

cppcheck - Online in the Cloud

Run cppcheck in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command cppcheck that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



cppcheck - Tool for static C/C++ code analysis


cppcheck [--append=<file>] [--check-config] [--check-library] [-D<id>] [-U<id>]
[--enable=<id>] [--error-exitcode=<n>] [--errorlist]
[--exitcode-suppressions=<file>] [--file-list=<file>] [--force] [--help]
[-I<dir>] [--includes-file=<file>] [--config-exclude=<dir>]
[--config-excludes-file=<file>] [--include=<file>] [-i<dir>] [--inconclusive]
[--inline-suppr] [-j<jobs>] [-l<load>] [--language=<language>] [--library=<cfg>]
[--max-configs=<limit>] [--platform=<type>] [--quiet] [--relative-paths=<paths>]
[--report-progress] [--rule=<rule>] [--rule-file=<file>] [--std=<id>]
[--suppress=<spec>] [--suppressions-list=<file>] [--template='<text>']
[--verbose] [--version] [--xml] [--xml-version=<version>]] [file or path] ...


Cppcheck is a command-line tool that tries to detect bugs that your C/C++ compiler doesn't
see. It is versatile, and can check non-standard code including various compiler
extensions, inline assembly code, etc. Its internal preprocessor can handle includes,
macros, and several preprocessor commands. While Cppcheck is highly configurable, you can
start using it just by giving it a path to the source code.


Analyze given C/C++ files for common errors.

This allows you to provide information about functions by providing an implementation
for these.

Check Cppcheck configuration. The normal code analysis is disabled by this flag.

Show information messages when library files have incomplete info.

By default Cppcheck checks all configurations. Use -D to limit the checking. When -D
is used the checking is limited to the given configuration. Example: -DDEBUG=1

By default Cppcheck checks all configurations. Use '-U' to explicitly hide certain
#ifdef <id> code paths from checking. Example: '-UDEBUG'

Enable additional checks. The available ids are:

Enable all checks. It is recommended to only use --enable=all when the whole
program is scanned, because this enables unusedFunction.

Enable warning messages

Enable all coding style checks. All messages with the severities 'style',
'performance' and 'portability' are enabled.

Enable performance messages

Enable portability messages

Enable information messages

Check for unused functions. It is recommend to only enable this when the whole
program is scanned

Warn if there are missing includes. For detailed information use --check-config

By default none of the additional checks are enabled. Several ids can be given if you
separate them with commas, e.g. --enable=style,unusedFunction. See also --std

If errors are found, integer <n> is returned instead of default 0. EXIT_FAILURE is
returned if arguments are not valid or if no input files are provided. Note that your
operating system can modify this value, e.g. 256 can become 0.

Print a list of all possible error messages in XML format.

Used when certain messages should be displayed but should not cause a non-zero

Specify the files to check in a text file. One filename per line. When file is -, the
file list will be read from standard input.

-f, --force
Force checking of files that have a lot of configurations. Error is printed if such a
file is found so there is no reason to use this by default. If used together with
--max-configs=, the last option is the one that is effective.

-h, --help
Print help text.

-I <dir>
Give path to search for include files. Give several -I parameters to give several
paths. First given path is searched for contained header files first. If paths are
relative to source files, this is not needed.

Specify directory paths to search for included header files in a text file. Add one
include path per line. First given path is searched for contained header files first.
If paths are relative to source files, this is not needed.

Path (prefix) to be excluded from configuration checking. Preprocessor configurations
defined in headers (but not sources) matching the prefix will not be considered for
evaluation of configuration alternatives.

A file that contains a list of config-excludes.

Force inclusion of a file before the checked file. Can be used for example when
checking the Linux kernel, where autoconf.h needs to be included for every file
compiled. Works the same way as the GCC -include option.

-i <dir>
Give path to ignore. Give several -i parameters to ignore several paths. Give
directory name or filename with path as parameter. Directory name is matched to all
parts of the path.

Allow that Cppcheck reports even though the analysis is inconclusive. There are false
positives with this option. Each result must be carefully investigated before you know
if it is good or bad.

Enable inline suppressions. Use them by placing comments in the form: //
cppcheck-suppress memleak before the line to suppress.

-j <jobs>
Start <jobs> threads to do the checking work.

-l <load>
Specifies that no new threads should be started if there are other threads running and
the load average is at least <load> (ignored on non UNIX-like systems)

Forces cppcheck to check all files as the given language. Valid values are: c, c++

Use library configuration.

Maximum number of configurations to check in a file before skipping it. Default is 12.
If used together with --force, the last option is the one that is effective.

Specifies platform specific types and sizes.The available platforms are:

32 bit unix variant

64 bit unix variant

32 bit Windows ASCII character encoding

32 bit Windows UNICODE character encoding

64 bit Windows

By default the platform which was used to compile Cppcheck is used.

-q, --quiet
Only print something when there is an error.

-rp, -rp=<paths>, --relative-paths;, --relative-paths=<paths>
Use relative paths in output. When given, <paths> are used as base. You can separate
multiple paths by ';'. Otherwise path where source files are searched is used. E.g. if
given value is test, when checking test/test.cpp, the path in output will be test.cpp
instead of test/test.cpp. The feature uses string comparison to create relative paths,
so using e.g. ~ for home folder does not work. It is currently only possible to apply
the base paths to files that are on a lower level in the directory tree.

Report progress when checking a file.

Match regular expression to create your own checks. E.g. rule "/ 0" can be used to
check division by zero. This command is only available if cppcheck was compiled with

Use given rule XML file. See https://sourceforge.net/projects/cppcheck/files/Articles/
for more info about the syntax. This command is only available if cppcheck was
compiled with HAVE_RULES=yes.

Set standard. The available options are:

POSIX compatible code

C code is C89 compatible

C code is C99 compatible

C code is C11 compatible (default)

C++ code is C++03 compatible

C++ code is C++11 compatible (default)

Example to set more than one standards: 'cppcheck --std=c99 --std=posix file.cpp'

Suppress a specific warning. The format of <spec> is: [error id]:[filename]:[line].
The [filename] and [line] are optional. [error id] may be * to suppress all warnings
(for a specified file or files). [filename] may contain the wildcard characters * or

Suppress warnings listed in the file. Each suppression is in the format of <spec>

Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or
'{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs

-v, --verbose
More detailed error reports

Print out version information

Write results in XML to error stream

Select the XML file version. Currently versions 1 and 2 are available. The default
version is 1.

Use cppcheck online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Sardi is a complete restyling and
    optimisation of svg code. 6 choices for
    your applications and 10 kind of folders
    to use in your file manager. The sardi
    Download Sardi
  • 2
    LMMS Digital Audio Workstation
    LMMS Digital Audio Workstation
    LMMS is a free cross-platform software
    which allows you to produce music with
    your computer. If you like this project
    consider getting involved in the project
    Download LMMS Digital Audio Workstation
  • 3
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS is a market-leading real-time
    operating system (RTOS) for
    microcontrollers and small
    microprocessors. Distributed freely
    under the MIT open source lice...
    Download FreeRTOS Real Time Kernel (RTOS)
  • 4
    Avogadro is an advanced molecular
    editor designed for cross-platform use
    in computational chemistry, molecular
    modeling, bioinformatics, materials
    science and ...
    Download Avogadro
  • 5
    XMLTV is a set of programs to process
    TV (tvguide) listings and help manage
    your TV viewing, storing listings in an
    XML-based format. There are utilities to
    Download XMLTV
  • 6
    Strikr Free Software project. Artifacts
    released under a 'intent based'
    dual license: AGPLv3 (community) and
    CC-BY-NC-ND 4.0 international
    Download strikr
  • More »

Linux commands