Enhance the precision of external symbols using CppDepend's capabilities

Exclude code and refine the externals

Introduction

CppDepend automatically analyzes your code base, distinguishing between your code and external symbols. However, sometimes it's necessary to manually adjust this by excluding certain parsed sources from your project when they are part of a third-party library. This involves reclassifying some symbols, moving them from your code to external projects or vice versa, to ensure a more accurate representation in CppDepend's analysis.

Go to top

Exclude third party sources.

When your project includes a third-party library as source code, CppDepend may recognize these files as part of your project. To address this, you can exclude these specific source files by navigating to "Project Properties -> Code To Analyze -> Exclude Projects, Folders and Files" in CppDepend. This allows for more accurate analysis by omitting the third-party library files from consideration.

Project Properties

Several exclusion options are offered, including:

  • Exclude projects: Remove an entire project by its name.
  • Exclude folders: Omit an entire folder.
  • Exclude files: Exclude specific files individually.
  • Exclude using Regex path: Utilize Regex paths for flexible exclusion of files or folders.
Exclude Project Options

Go to top

Transfer code from your own project to external projects.

If CppDepend mistakenly identifies external symbols as part of your code, you can reassign them to an external library by following a specific set of steps. This process involves adjusting the categorization within CppDepend to ensure that these symbols are correctly associated with external libraries rather than your own code base:

  • Initiate the ProjectMaker tool, accessible through the Tools Menu in CppDepend.

    Launch Project Maker
  • Choose the "AddProject" option and name the new project identically to your existing project that you wish to refine.

    add Project
  • Proceed by incorporating the include files you want to classify as external in the next step.
    Add Existing Directory
  • To complete the process, add the .sl file created by the Project Maker. You can do this by going to "Project Properties->Code To Analyze" and then selecting "Add build specification generated by project maker."

Go to top

Relocate code from external libraries to your own project

If CppDepend classifies some of your code's symbols as external, you can realign them back to your code by following a specific set of instructions. This process involves modifying the categorization within CppDepend to ensure these symbols are appropriately recognized as part of your project.

  • Start the ProjectMaker tool from the CppDepend Tools Menu to begin the process.

    Launch Project Maker
  • Choose the "AddProject" function and assign it the same name as the project you are looking to enhance.

    add Project
  • Within the project properties, ensure to select the option "Is this project external".

    External option
  • The subsequent step involves incorporating the include files that you want to be recognized as part of your code.
    Add Existing Directory

  • Lastly, include the .sl file that the Project Maker generated into your project. This can be done by going to "Project Properties->Code To Analyze" and then selecting the option to "Add build specification generated by project maker."

Go to top

Consolidate external symbols into a single library

Following the analysis of your projects, you might find that some external symbols are grouped in a default external project labeled as "Externals".

Externals

To better organize external symbols and assign them to their respective external projects rather than a generic one, you can follow these steps:

  • Firstly, create a project as previously described.
  • Then, add the directory containing the library's include files to this project.
  • In the project properties, make sure to select the option that indicates "This project is external".

    External option
  • Finally, incorporate the .sl file generated by the Project Maker. You can do this by navigating to "Project Properties -> Code To Analyze" and then choosing the option to "Add build specification generated by project maker".

This process will help in organizing and accurately categorizing external symbols for your project.

Go to top

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

Start Free Trial