Skip to content

sonar.cxx.forceIncludes

Günter Wirth edited this page Jan 8, 2022 · 8 revisions

Force Include

The cxx plugin provides force-including of header files. Force-including files is sometimes a useful method for defining macros, types or compiler-specific extensions.

This option has the same effect as specifying the file with double quotation marks in an #include directive on the first line of every source file When you add multiple files, they are included in the file to be compiled in the order in which they are listed, from left to right.

The search order for the header files is the same as the quoted include form. The order can be defined via sonar.cxx.includeDirectories.

With sonar.cxx.forceIncludes and sonar.cxx.defines the predefined macro values can be redefined.

See also

Example

sonar.cxx.forceIncludes=VS10Macros.h,MyMacros.h

Original source code file:

// Comment
#include "stdafx.h"
#include "..."
...
// your source code ...

Resulting source code file:

#include "VS10Macros.h"
#include "MyMacros.h"
// Comment
#include "stdafx.h"
#include "..."
...
// your source code ...
Clone this wiki locally