static analysis of C/C++ code
Go to file
Martin Ettl c3a08bf108 TestMathLib: added robustness tests for testing MathLib::isFloat. Ensure it works correctly for preceeding and trailing white spaces. 2014-02-22 21:36:51 +01:00
Cppcheck.xcodeproj Register valueflow.{h,cpp} to XCode projects. 2014-01-10 21:03:33 +01:00
cfg Fix & complete windows.cfg (likely not exhaustive) 2014-02-12 16:55:51 +01:00
cli Update copyright 2014-02-15 07:45:39 +01:00
democlient
externals/tinyxml
gui Update copyright 2014-02-15 07:45:39 +01:00
htdocs htdocs: update dependencies. 2014-02-15 13:26:04 +02:00
htmlreport
lib Fixed #5434 (FP: Out-of-bounds access with ternary operator in loop) 2014-02-22 17:59:12 +01:00
man
rules
samples
test TestMathLib: added robustness tests for testing MathLib::isFloat. Ensure it works correctly for preceeding and trailing white spaces. 2014-02-22 21:36:51 +01:00
tools daca2: tell wget to overwrite file. We want that the correct file is used. 2014-02-22 07:52:51 +01:00
win_installer Small ReadMe updates 2014-01-04 12:38:23 +01:00
.gitattributes
.gitignore
.mailmap
.travis.yml travis: sent out build failure notification as soon as the first job fails using matrix: fast_finish: true 2014-01-17 20:46:20 +01:00
.travis_suppressions revert: commit f6da9d4e3c 2014-01-12 22:47:21 +01:00
AUTHORS
COPYING
Makefile Emulate the C++11 'nullptr' and 'static_assert' 2014-02-15 07:52:17 +01:00
build-pcre.txt
build.bat
console_common.pri
cppcheck.cbp
cppcheck.cppcheck
cppcheck.sln Removed VS9 solution 2014-01-04 10:55:27 +01:00
createrelease
doxyfile
generate_coverage_report
readme.md readme: document how a project file or Makefile is created for Cppcheck 2014-02-15 08:22:13 +01:00
readme.txt readme: document how a project file or Makefile is created for Cppcheck 2014-02-15 08:22:13 +01:00
readme_64-bit_Windows.txt Removed VS9 solution 2014-01-04 10:55:27 +01:00
readme_gui.txt Small ReadMe updates 2014-01-04 12:38:23 +01:00
runastyle runastyle: Ignore user's default options file 2014-01-16 01:29:33 +01:00
runastyle.bat
webreport.sh

readme.md

Cppcheck Build Status Coverity Scan Build Status

Donations

If you find Cppcheck useful for you, feel free to make a donation.

Donate

About the name

The original name of this program was "C++check", but it was later changed to "Cppcheck".

Despite the name, Cppcheck is designed for both C and C++.

Manual

A manual is available online.

Compiling

Any C++ compiler should work.

To build the GUI, you need Qt.

When building the command line tool, PCRE is normally used. PCRE is optional.

There are multiple compilation choices:

  • qmake - cross platform build tool
  • Windows: Visual Studio or Qt Creator or MinGW
  • gnu make
  • g++

qmake

You can use the gui/gui.pro file to build the GUI.

cd gui
qmake
make

Visual Studio

Use the cppcheck.sln file. The rules are normally enabled.

To compile with rules (PCRE dependency):

  • the PCRE dll is needed. It can be downloaded from here.

To compile without rules (no dependencies):

  • remove the preprocessor define HAVE_RULES from the project
  • remove the pcre.lib from the project

Qt Creator + MinGW

The PCRE dll is needed to build the CLI. It can be downloaded here: http://software-download.name/pcre-library-windows/

GNU make

Simple build (no dependencies):

make

The recommended release build is:

make SRCDIR=build CFGDIR=cfg HAVE_RULES=yes

Flags:

  1. SRCDIR=build

    Python is used to optimise cppcheck

  2. CFGDIR=cfg

    Specify folder where .cfg files are found

  3. HAVE_RULES=yes

    Enable rules (PCRE is required if this is used)

g++ (for experts)

If you just want to build Cppcheck without dependencies then you can use this command:

g++ -o cppcheck -Ilib cli/*.cpp lib/*.cpp

If you want to use --rule and --rule-file then dependencies are needed:

g++ -o cppcheck -lpcre -DHAVE_RULES -Ilib -Iexternals cli/*.cpp lib/*.cpp externals/tinyxml/*.cpp

MinGW

make LDFLAGS=-lshlwapi

Other Compiler/IDE

  1. Create a empty project file / makefile.
  2. Add all cpp files in the cppcheck cli and lib folders to the project file / makefile.
  3. Compile.

Cross compiling Win32 (CLI) version of Cppcheck in Linux

sudo apt-get install mingw32
make CXX=i586-mingw32msvc-g++ LDFLAGS="-lshlwapi"
mv cppcheck cppcheck.exe

Webpage

http://cppcheck.sourceforge.net/