Getting started with CppDepend on Linux

Getting Started with CppDepend on Linux

CppDepend Installation and configuration

How do I analyze my C\C++ applications using CppDepend?

  • Prepare your projects build specification
    CppDepend analyze out of the box QtCreator and Eclipse projects, so if you have any of these kind of projects you can skip this step. Otherwise, you have to generate a json compilation database. A compilation database is a database for compile options. It records which compile options are used to build the files in a project. The compilation database could be generated from CMake or Ninja, and there are many other ways to generate a compilation database as descibed here.
    In case you do not use any of the mentioned tools, CppDepend includes the Bear tool to generate the compilation database, the usage is like this:

    bear your-build-command

    In case you can't generate a compilation database, yu can use our ProjectMaker tool to describe your build specification.

  • Execute ./ to start VisualCppDepend.
  • Create New CppDepend Project

  • Add your C/C++ projects.

    The following kind of projects are managed by CppDepend:

    • Eclipse projects.
    • QtCreator projects.
    • Json compilation database.
    • Set of source files: You can use the ProjectMaker tool to describe the specification of your project. With ProjectMaker you can specify your source files, the include paths and the defines.
  • Launch the analysis from the toolbar. The analysis will take a few seconds to a few minutes depending on the size of the projects.
  • Once the analysis done, the result is displayed in the VisualCppDepend.exe UI.

What does the CppDepend report tell me about my code?

  • Application Metric: This section gives you an idea of the topology of your application.
  • Project Metric: This section gives you an idea of the size of each project within your application in terms of code line and others metrics.
  • VisualCppDepend View: This section illustrates the size of your projects, namespaces, types and methods in terms of code line. You can browse this view dynamically by clicking the Launch Visual CppDepend on this Project icon in the CppDepend.Project UI.
  • Project Abstractness vs. Instability: This section illustrate the Abstractness/Instability principle explained in the projects metrics section.
  • Project Dependencies: This section shows all dependencies between project of your application in a table.
  • Project Dependency Diagram: This section shows all dependencies between projects of your application in a diagram
  • Project build order: This section gives you one of the possible build order for your projects. If a cycle exists in your projects dependencies graph, this section will report it.
  • CQLinq Queries and Constraints: This section reports default CQLinq constraints which have been violated. More about the CQLinq language and CQL constraints here. You can build your own CQLinq constraints with VisualCppDepend.
  • Type Metrics: This section recaps type metrics in a table. A link to the documentation is provided for each metric.

I want to go further to have a better control over my code

  • Understand metrics yielded by CppDepend and read recommendations.
  • Get a new understanding of your code by playing with the CppDepend panels. Modify the view with the Level and Metric combo boxes.
  • Fine-tune your report thanks to the Output panel in the CppDepend.Project UI.
  • Learn CQLinq, adapt existing CQLinq code rules and create your own ones.
  • Integrate the CppDepend report in your daily build process.

CppDepend offers a wide range of features. It is often described as a Swiss Army Knife for C and C++ developers.

Start Free Trial