How To Install cppcheck on Fedora 34

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

Introduction

In this tutorial we learn how to install cppcheck on Fedora 34.

What is cppcheck

Cppcheck is a static analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools it does not detect syntax errors in the code. Cppcheck primarily detects the types of bugs that the compilers normally do not detect. The goal is to detect only real errors in the code (i.e. have zero false positives).

We can use yum or dnf to install cppcheck on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install cppcheck.

Install cppcheck on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install cppcheck using dnf by running the following command:

sudo dnf -y install cppcheck

Install cppcheck on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install cppcheck using yum by running the following command:

sudo yum -y install cppcheck

How To Uninstall cppcheck on Fedora 34

To uninstall only the cppcheck package we can use the following command:

sudo dnf remove cppcheck

cppcheck Package Contents on Fedora 34

/usr/bin/cppcheck
/usr/lib/.build-id
/usr/lib/.build-id/06
/usr/lib/.build-id/06/51511096f01ba7260859249df659855270c0bc
/usr/share/Cppcheck
/usr/share/Cppcheck/addons
/usr/share/Cppcheck/addons/__init__.py
/usr/share/Cppcheck/addons/cert.py
/usr/share/Cppcheck/addons/cppcheckdata.py
/usr/share/Cppcheck/addons/findcasts.py
/usr/share/Cppcheck/addons/misc.py
/usr/share/Cppcheck/addons/misra.py
/usr/share/Cppcheck/addons/misra_9.py
/usr/share/Cppcheck/addons/naming.py
/usr/share/Cppcheck/addons/namingng.py
/usr/share/Cppcheck/addons/threadsafety.py
/usr/share/Cppcheck/addons/y2038.py
/usr/share/Cppcheck/cfg
/usr/share/Cppcheck/cfg/avr.cfg
/usr/share/Cppcheck/cfg/bento4.cfg
/usr/share/Cppcheck/cfg/boost.cfg
/usr/share/Cppcheck/cfg/bsd.cfg
/usr/share/Cppcheck/cfg/cairo.cfg
/usr/share/Cppcheck/cfg/cppcheck-lib.cfg
/usr/share/Cppcheck/cfg/cppunit.cfg
/usr/share/Cppcheck/cfg/daca.cfg
/usr/share/Cppcheck/cfg/dpdk.cfg
/usr/share/Cppcheck/cfg/embedded_sql.cfg
/usr/share/Cppcheck/cfg/emscripten.cfg
/usr/share/Cppcheck/cfg/ginac.cfg
/usr/share/Cppcheck/cfg/gnu.cfg
/usr/share/Cppcheck/cfg/googletest.cfg
/usr/share/Cppcheck/cfg/gtk.cfg
/usr/share/Cppcheck/cfg/icu.cfg
/usr/share/Cppcheck/cfg/kde.cfg
/usr/share/Cppcheck/cfg/libcerror.cfg
/usr/share/Cppcheck/cfg/libcurl.cfg
/usr/share/Cppcheck/cfg/libsigc++.cfg
/usr/share/Cppcheck/cfg/lua.cfg
/usr/share/Cppcheck/cfg/mfc.cfg
/usr/share/Cppcheck/cfg/microsoft_atl.cfg
/usr/share/Cppcheck/cfg/microsoft_sal.cfg
/usr/share/Cppcheck/cfg/microsoft_unittest.cfg
/usr/share/Cppcheck/cfg/motif.cfg
/usr/share/Cppcheck/cfg/nspr.cfg
/usr/share/Cppcheck/cfg/ntl.cfg
/usr/share/Cppcheck/cfg/opencv2.cfg
/usr/share/Cppcheck/cfg/opengl.cfg
/usr/share/Cppcheck/cfg/openmp.cfg
/usr/share/Cppcheck/cfg/openssl.cfg
/usr/share/Cppcheck/cfg/pcre.cfg
/usr/share/Cppcheck/cfg/posix.cfg
/usr/share/Cppcheck/cfg/python.cfg
/usr/share/Cppcheck/cfg/qt.cfg
/usr/share/Cppcheck/cfg/ruby.cfg
/usr/share/Cppcheck/cfg/sdl.cfg
/usr/share/Cppcheck/cfg/sfml.cfg
/usr/share/Cppcheck/cfg/sqlite3.cfg
/usr/share/Cppcheck/cfg/std.cfg
/usr/share/Cppcheck/cfg/tinyxml2.cfg
/usr/share/Cppcheck/cfg/vcl.cfg
/usr/share/Cppcheck/cfg/windows.cfg
/usr/share/Cppcheck/cfg/wxsqlite3.cfg
/usr/share/Cppcheck/cfg/wxsvg.cfg
/usr/share/Cppcheck/cfg/wxwidgets.cfg
/usr/share/Cppcheck/cfg/zlib.cfg
/usr/share/Cppcheck/help
/usr/share/Cppcheck/help/online-help.qch
/usr/share/Cppcheck/help/online-help.qhc
/usr/share/Cppcheck/lang
/usr/share/Cppcheck/lang/cppcheck_de.qm
/usr/share/Cppcheck/lang/cppcheck_es.qm
/usr/share/Cppcheck/lang/cppcheck_fi.qm
/usr/share/Cppcheck/lang/cppcheck_fr.qm
/usr/share/Cppcheck/lang/cppcheck_it.qm
/usr/share/Cppcheck/lang/cppcheck_ja.qm
/usr/share/Cppcheck/lang/cppcheck_ko.qm
/usr/share/Cppcheck/lang/cppcheck_nl.qm
/usr/share/Cppcheck/lang/cppcheck_ru.qm
/usr/share/Cppcheck/lang/cppcheck_sr.qm
/usr/share/Cppcheck/lang/cppcheck_sv.qm
/usr/share/Cppcheck/lang/cppcheck_zh_CN.qm
/usr/share/Cppcheck/platforms
/usr/share/Cppcheck/platforms/aix_ppc64.xml
/usr/share/Cppcheck/platforms/arm32-wchar_t2.xml
/usr/share/Cppcheck/platforms/arm32-wchar_t4.xml
/usr/share/Cppcheck/platforms/arm64-wchar_t2.xml
/usr/share/Cppcheck/platforms/arm64-wchar_t4.xml
/usr/share/Cppcheck/platforms/avr8.xml
/usr/share/Cppcheck/platforms/cray_sv1.xml
/usr/share/Cppcheck/platforms/elbrus-e1cp.xml
/usr/share/Cppcheck/platforms/mips32.xml
/usr/share/Cppcheck/platforms/msp430_eabi_large_datamodel.xml
/usr/share/Cppcheck/platforms/pic16.xml
/usr/share/Cppcheck/platforms/pic8-enhanced.xml
/usr/share/Cppcheck/platforms/pic8.xml
/usr/share/Cppcheck/platforms/unix32-unsigned.xml
/usr/share/Cppcheck/platforms/unix64-unsigned.xml
/usr/share/doc/cppcheck
/usr/share/doc/cppcheck/AUTHORS
/usr/share/doc/cppcheck/manual.html
/usr/share/doc/cppcheck/reference-cfg-format.html
/usr/share/licenses/cppcheck
/usr/share/licenses/cppcheck/COPYING
/usr/share/man/man1/cppcheck.1.gz
/usr/bin/cppcheck
/usr/lib/.build-id
/usr/lib/.build-id/51
/usr/lib/.build-id/51/879118a07f41a3f587d3ae03b1a9a8f0782de5
/usr/share/Cppcheck
/usr/share/Cppcheck/addons
/usr/share/Cppcheck/addons/__init__.py
/usr/share/Cppcheck/addons/cert.py
/usr/share/Cppcheck/addons/cppcheckdata.py
/usr/share/Cppcheck/addons/findcasts.py
/usr/share/Cppcheck/addons/misc.py
/usr/share/Cppcheck/addons/misra.py
/usr/share/Cppcheck/addons/naming.py
/usr/share/Cppcheck/addons/namingng.py
/usr/share/Cppcheck/addons/threadsafety.py
/usr/share/Cppcheck/addons/y2038.py
/usr/share/Cppcheck/cfg
/usr/share/Cppcheck/cfg/avr.cfg
/usr/share/Cppcheck/cfg/boost.cfg
/usr/share/Cppcheck/cfg/bsd.cfg
/usr/share/Cppcheck/cfg/cairo.cfg
/usr/share/Cppcheck/cfg/cppcheck-lib.cfg
/usr/share/Cppcheck/cfg/cppunit.cfg
/usr/share/Cppcheck/cfg/daca.cfg
/usr/share/Cppcheck/cfg/embedded_sql.cfg
/usr/share/Cppcheck/cfg/emscripten.cfg
/usr/share/Cppcheck/cfg/gnu.cfg
/usr/share/Cppcheck/cfg/googletest.cfg
/usr/share/Cppcheck/cfg/gtk.cfg
/usr/share/Cppcheck/cfg/icu.cfg
/usr/share/Cppcheck/cfg/kde.cfg
/usr/share/Cppcheck/cfg/libcerror.cfg
/usr/share/Cppcheck/cfg/libcurl.cfg
/usr/share/Cppcheck/cfg/libsigc++.cfg
/usr/share/Cppcheck/cfg/lua.cfg
/usr/share/Cppcheck/cfg/mfc.cfg
/usr/share/Cppcheck/cfg/microsoft_atl.cfg
/usr/share/Cppcheck/cfg/microsoft_sal.cfg
/usr/share/Cppcheck/cfg/microsoft_unittest.cfg
/usr/share/Cppcheck/cfg/motif.cfg
/usr/share/Cppcheck/cfg/nspr.cfg
/usr/share/Cppcheck/cfg/opencv2.cfg
/usr/share/Cppcheck/cfg/opengl.cfg
/usr/share/Cppcheck/cfg/openmp.cfg
/usr/share/Cppcheck/cfg/openssl.cfg
/usr/share/Cppcheck/cfg/posix.cfg
/usr/share/Cppcheck/cfg/python.cfg
/usr/share/Cppcheck/cfg/qt.cfg
/usr/share/Cppcheck/cfg/ruby.cfg
/usr/share/Cppcheck/cfg/sdl.cfg
/usr/share/Cppcheck/cfg/sfml.cfg
/usr/share/Cppcheck/cfg/sqlite3.cfg
/usr/share/Cppcheck/cfg/std.cfg
/usr/share/Cppcheck/cfg/tinyxml2.cfg
/usr/share/Cppcheck/cfg/windows.cfg
/usr/share/Cppcheck/cfg/wxwidgets.cfg
/usr/share/Cppcheck/cfg/zlib.cfg
/usr/share/Cppcheck/help
/usr/share/Cppcheck/help/online-help.qch
/usr/share/Cppcheck/help/online-help.qhc
/usr/share/Cppcheck/lang
/usr/share/Cppcheck/lang/cppcheck_de.qm
/usr/share/Cppcheck/lang/cppcheck_es.qm
/usr/share/Cppcheck/lang/cppcheck_fi.qm
/usr/share/Cppcheck/lang/cppcheck_fr.qm
/usr/share/Cppcheck/lang/cppcheck_it.qm
/usr/share/Cppcheck/lang/cppcheck_ja.qm
/usr/share/Cppcheck/lang/cppcheck_ko.qm
/usr/share/Cppcheck/lang/cppcheck_nl.qm
/usr/share/Cppcheck/lang/cppcheck_ru.qm
/usr/share/Cppcheck/lang/cppcheck_sr.qm
/usr/share/Cppcheck/lang/cppcheck_sv.qm
/usr/share/Cppcheck/lang/cppcheck_zh_CN.qm
/usr/share/Cppcheck/platforms
/usr/share/Cppcheck/platforms/aix_ppc64.xml
/usr/share/Cppcheck/platforms/arm32-wchar_t2.xml
/usr/share/Cppcheck/platforms/arm32-wchar_t4.xml
/usr/share/Cppcheck/platforms/arm64-wchar_t2.xml
/usr/share/Cppcheck/platforms/arm64-wchar_t4.xml
/usr/share/Cppcheck/platforms/avr8.xml
/usr/share/Cppcheck/platforms/cray_sv1.xml
/usr/share/Cppcheck/platforms/elbrus-e1cp.xml
/usr/share/Cppcheck/platforms/mips32.xml
/usr/share/Cppcheck/platforms/msp430_eabi_large_datamodel.xml
/usr/share/Cppcheck/platforms/pic16.xml
/usr/share/Cppcheck/platforms/pic8-enhanced.xml
/usr/share/Cppcheck/platforms/pic8.xml
/usr/share/Cppcheck/platforms/unix32-unsigned.xml
/usr/share/Cppcheck/platforms/unix64-unsigned.xml
/usr/share/doc/cppcheck
/usr/share/doc/cppcheck/AUTHORS
/usr/share/doc/cppcheck/manual.html
/usr/share/doc/cppcheck/reference-cfg-format.html
/usr/share/licenses/cppcheck
/usr/share/licenses/cppcheck/COPYING
/usr/share/man/man1/cppcheck.1.gz

References

Summary

In this tutorial we learn how to install cppcheck on Fedora 34 using yum and dnf.