How do I install Cppcheck using the tar file on Linux?

Tony Tran picture Tony Tran · Dec 18, 2014 · Viewed 12.2k times · Source

I'm trying to install Cppcheck via telnet on a Linux box. I have the cppcheck-1.67.tar file and I untar it. I don't see anything that will install it for me. Am I approaching this the correct way?

Answer

PADYMKO picture PADYMKO · Dec 16, 2016

Actual on a date publication of this answer.

  1. Download file from there https://sourceforge.net/projects/cppcheck/

  2. Go to the folder with for downloads

    cd ~/Downloads/
    
  3. Unpack archive

    tar -xvf cppcheck-1.76.1.tar.bz2
    
  4. Go to unpacked folder

    cd cppcheck-1.76.1/
    
  5. Install package as root

    sudo make install
    
  6. Check up result

    $ which cppcheck
    /usr/bin/cppcheck
    
  7. Testing it

    $ touch simple.c
    $ echo "int main(){ int a; a + 1; return 0}" > simple.c
    $ cppcheck simple.c
    Checking simple.c ...
    [simple.c:1]: (error) Uninitialized variable: a
    

This package also exists in a standard repository.

$ aptitude search cppcheck
p   cppcheck                      - tool for static C/C++ code analysis

Testing environment

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:    8.6
Codename:    jessie
$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux