3.7. C/C++ Compiler Definitions

Sonargraph uses internally the Edison Design Group (EDG) C/C++ Front End to parse C/C++ sources. In order to emulate the behavior of your C/C++ compiler, Sonargraph needs a compiler definition. A compiler definition contains the location of the directories containing the system include files, a list of predefined macros and other options for the EDG parser defining language features and compatibility levels. You will not be able to successfully parse a software system without a proper compiler definition for your compiler. One compiler definition has to be set as the "active" definition, which will be used by default for opened software systems containing C/C++ modules.

Sonargraph comes with pre-defined compiler definitions that are activated by default depending on the platform Sonargraph is running on:

  • "CLang" for Mac OS-X.

  • "GnuCpp" for GNU C++ compiler on Unix based systems (Linux, Unix).

  • "VisualCpp_x_y_z" for Windows based systems that have Microsoft Visual Studio Compiler installed. (x = version, y=architecture, z=processor, e.g. VisualCpp_12.0_x86_amd64)

In the "Preferences..." menu, you can manage and modify existing compiler definitions or even create new ones based on existing compiler definitions.

C++ Compiler Definition
Figure 3.5. C++ Compiler Definition

The translation tab allows to define how options retrieved from imports need to be handled: For C++ modules created based on imports (e.g Makefile or Visual Studio 2010 project files (.vcxproj)), only macro (-D) and include (-I) preprocessor options will be applied. Use the translation functionality if any additional options of the imported project are required for parsing or the EDG parser uses a different value than your standard compiler.

For certain compilers it is possible to dynamically retrieve predefined macros and the include search path. To do that compiler definitions can be based on Groovy templates that invoke the compiler to query those settings. This is of course not possible for all compilers. Therefore we also have created a compiler definition wizard that will collect the information about the compiler to be emulated from you. You can invoke this wizard from the "File""New""Configuration..." menu. The wizard also supports the import of compiler definitions from Sotograph. (Previous tool from hello2morrow)


You need to "activate" a compiler definition to use it for parsing. Just selecting a definition is not enough.


Replacing the active compiler definition or modifying its content will force a reparse of the currently loaded software system as soon as the compiler definition is activated or the changes are applied.

By default, compiler definitions are stored in the Sonargraph home directory. These definitions are not intended to be shared. If you want to share compiler definitions across team members, it is recommended to specify a separate directory in the search path that contains these shared definitions. See section Section 3.9, “Search Path Configuration” .