Main Content

-I

Specify include folder for compilation

Syntax

-I folder

Description

-I folder specifies a folder that contains include files required for compiling your sources. You can specify only one folder for each instance of -I. However, you can specify this option multiple times.

The analysis looks for include files relative to the folder paths that you specify. For instance, if your code contains the preprocessor directive #include<../mylib.h> and you include the folder:

C:\My_Project\MySourceFiles\Includes
the folder C:\My_Project\MySourceFiles must contain a file mylib.h.

The analysis automatically includes the ./sources folder (if it exists) after the include folders that you specify.

Examples

Include two folders with the analysis:

  • Bug Finder:

    polyspace-bug-finder -I /com1/inc -I /com1/sys/inc
  • Code Prover:

    polyspace-code-prover -I /com1/inc -I /com1/sys/inc
  • Bug Finder Server:

    polyspace-bug-finder-server -I /com1/inc -I /com1/sys/inc
  • Code Prover Server:

    polyspace-code-prover-server -I /com1/inc -I /com1/sys/inc

The source folder is implicitly included. Include files in the source folder can be found automatically without explicit inclusion of the source folder with the -I option.

Tips

  • This option is useful for Polyspace® analysis from the command line. In the Polyspace user interface, you add the include folders during project setup. See Add Source Files for Analysis in Polyspace User Interface.

  • If you use Polyspace as You Code extensions in IDEs, enter this option in an analysis options file. See options file.

  • The option -I does not work recursively. If you add a folder path using this option, the analysis only considers include files that are directly in the folder and not in subfolders of the folder. If you also want subfolders in the include search path, explicitly add the subfolder paths using their own -I-s. For convenience, you can write a script that recursively looks through a folder and generates -I-s to subfolders of the folder.