メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

getUndefines

From build information, get preprocessor macros to undefine

R2024a 以降

説明

undefines = getUndefines(buildinfo,includeGroups,excludeGroups) gets, from the build information, preprocessor macros to undefine.

すべて折りたたむ

This example shows how to get, from a build information object, preprocessor macros to undefine.

Suppose you have two files, myFile.c and myInc.h, in your current working folder.

// myFile.c
#include <stdio.h>
int main(void) {
    #ifdef __STDC_VERSION__
    printf("__STDC_VERSION__ is defined\n");
    #else
    printf("__STDC_VERSION__ is not defined\n");
    #endif
 
    #ifdef MY_MACRO
    printf("MY_MACRO is defined\n");
    #else
    printf("MY_MACRO is not defined\n");
    #endif
}


// myInc.h
#ifndef MYINC_H
#define MYINC_H
 
#define MY_MACRO
 
#endif

Create an RTW.BuildInfo object and specify source files, undefine directives, and preinclude files.

buildInfo = RTW.BuildInfo;
buildInfo.ComponentName = 'MyComponent';
addSourceFiles(buildInfo, 'myfile.c');
addUndefines(buildInfo, '__STDC_VERSION__');
addPreincludeFiles(buildInfo, 'myinc.h');

Get the preprocessor macros to undefine.

undefines=getUndefines(buildInfo)
undefines =

  1×1 cell array

    {'__STDC_VERSION__'}

入力引数

すべて折りたたむ

Required. RTW.BuildInfo object that contains information for compiling and linking generated code.

Optional. Specify the undefine preprocessor macro groups that you want to include in the query. To view the group name of a macro group, access the Group property of the corresponding object.

Optional. Specify the undefine preprocessor macro groups that you want to exclude from the query. To view the group name of a macro group, access the Group property of the corresponding object.

Output Arguments

すべて折りたたむ

Preprocessor macros to undefine, which the function obtains from the build information.

バージョン履歴

R2024a で導入