CCCC (C and C++ Code Counter) is a little command-line tool that generates metrics from the source code of a C or C++ project. The output of the tool is a simple HTML website with information about all your sources.
CCCC generates not only information about the number of lines of codes for each of your modules, but also complexity metrics like the McCabe Cyclomatic Complexity level of your modules and functions, design metrics like the coupling between the modules or object oriented metrics like the depth of inheritance tree for each of your classes, …
On some Linux systems, cccc is already packaged, so you just have to use your favourite package manager to install it. On Ubuntu, I used :
sudo apt-get install cccc
to install it. If the tool is not packaged for your system, you can download it here. Then, you have run the build script :
and you will find a cccc executable in the cccc folder. You can just put the executable in your path or use it using the absolute path.
The usage of the tool is really easy. You just have to invoke it passing all the sources files you want to parse as arguments. For example:
cccc src/*.cpp include/*.hpp
And the site will be generated in a .cccc folder in the current folder. You can also specify the output directory using the –outdir=folder option.
The main entry of the HTML generated website is the cccc.html file. As an example, I uploaded the metrics of the compiler of the EDDI language here.
You can find more information about the tool on the official website : http://cccc.sourceforge.net/