Main Content

addIncludeFiles

Add include files to build information

Description

addIncludeFiles(buildinfo,filenames,paths,groups) specifies included files and paths to add to the build information.

The function requires the buildinfo and filenames arguments. You can use an optional paths argument to specify the included file paths and use an optional groups argument to group your options.

The code generator stores the included file and path options in a build information object. The function adds options to the object based on the order in which you specify them.

Note

The function does not:

  • Add the file paths to the compiler search path. See addIncludePaths.

  • Produce #include directives in the generated code

example

Examples

collapse all

Add the include file mytypes.h to the build information myBuildInfo and place the file in the group SysFiles.

myBuildInfo = RTW.BuildInfo;
addIncludeFiles(myBuildInfo, ... 
   'mytypes.h','/proj/src','SysFiles');

Add the include files etc.h and etc_private.h to the build information myBuildInfo, and place the files in the group AppFiles.

myBuildInfo = RTW.BuildInfo;
addIncludeFiles(myBuildInfo, ... 
   {'etc.h' 'etc_private.h'}, ...
   '/proj/src','AppFiles');

Add the include files etc.h, etc_private.h, and mytypes.h to the build information myBuildInfo. Group the files etc.h and etc_private.h with the character vector AppFiles and the file mytypes.h with the character vector SysFiles.

myBuildInfo = RTW.BuildInfo;
addIncludeFiles(myBuildInfo, ... 
{'etc.h' 'etc_private.h' 'mytypes.h'}, ... 
   '/proj/src', ...
   {'AppFiles' 'AppFiles' 'SysFiles'});

Add the include files (.h files identified with a wildcard character) in a specified folder to the build information myBuildInfo, and place the files in the group HFiles.

myBuildInfo = RTW.BuildInfo;
addIncludeFiles(myBuildInfo, ... 
   '*.h', '/proj/src', 'HFiles');

Input Arguments

collapse all

Object provides information for compiling and linking generated code.

You can specify the filenames argument as a character vector, as an array of character vectors, or as a string. If you specify the filenames argument as multiple character vectors, for example, 'etc.h' 'etc_private.h', the filenames argument is added to the build information as an array of character vectors.

If the dot delimiter (.) is present, the file name text can include wildcard characters. Examples are '*.*', '*.h', and '*.h*'.

The function removes duplicate included file entries with an exact match of a path and file name to a previously defined entry in the build information object.

Example: '*.h'

You can specify the paths argument as a character vector, as an array of character vectors, or as a string. If you specify a single path as a character vector, the function uses that path for all files. If you specify the paths argument as multiple character vectors, for example, '/proj/src' and '/proj/inc', the paths argument is added to the build information as an array of character vectors.

Example: '/proj/src'

You can specify the groups argument as a character vector, as an array of character vectors, or as a string. If you specify multiple groups, for example, 'AppFiles' 'AppFiles' 'SysFiles', the function relates the groups to the filenames in order of appearance. For example, the filenames argument 'etc.h' 'etc_private.h' 'mytypes.h' is an array of character vectors with three elements. The first element is in the 'AppFiles' group, the second element is in the 'AppFiles' group, and the third element is in the 'SysFiles' group.

Example: 'AppFiles' 'AppFiles' 'SysFiles'

Version History

Introduced in R2006a