Main Content

Standard math library


Specify standard math library for model.

Category: Code Generation > Interface


Default: C99 (ISO) or, if Language is set to C++, C++03 (ISO)

C89/C90 (ANSI)

Generates calls to the ISO®/IEC 9899:1990 C standard math library.

C99 (ISO)

Generates calls to the ISO/IEC 9899:1999 C standard math library.

C++03 (ISO)

Generates calls to the ISO/IEC 14882:2003 C++ standard math library.

C++11 (ISO)

Generates calls to the ISO/IEC 14882:2011 C++ standard math library.


  • Before setting this parameter, verify that your compiler supports the library you want to use. If you select a parameter value that your compiler does not support, compiler errors can occur.

  • If you are using a compiler that does not support ISO/IEC 9899:1999 C, set this parameter to C89/C90 (ANSI).

  • The build process checks whether the specified standard math library and toolchain are compatible. If they are not compatible, a warning occurs during code generation and the build process continues.

  • If you use a Linux® GCC compiler for the build process, the software uses the compiler default language standard to compile the generated code. Depending on the compiler version, the default language standard varies. For more information, see

    For example, if you use the GCC compiler version 8.x and set the parameter Standard math library to C++03, the software uses the C++14 language standard during compilation. The usage of C++14 enables building the generated code that integrates custom code that uses C++11 or C++14 features.

    If you want to enforce the language standard specified in the parameter on the compilation process, then you must add language standard specific compiler flags manually. If your model is configured to use a toolchain for building code, use this procedure:

    1. In the Configuration Parameters dialog box, set Build configuration to Specify.

    2. Under Toolchain details, at the end of the C Compiler and C++ Compiler Options field entries, manually add these compiler flags:

      • When the Standard math library is set to C99(ISO), add the flag -std=c99 -pedantic.

      • When the Standard math library is set to C89/90(ANSI), add the flag -ansi -pedantic.

      • When the Standard math library is set to C++03, add the flag -std=c++03 -pedantic.

      • When the Standard math library is set to C++11, add the flag -std=c++11 -pedantic.


  • C++03 is available for use only if you select C++ for the Language parameter.

  • When you change the value of the Language parameter, the standard math library is updated to C99 (ISO) for C and C++03 (ISO) or C++11 (ISO) for C++.

Command-Line Information

Parameter: TargetLangStandard
Type: character vector
Value: 'C89/C90 (ANSI)' | 'C99 (ISO)' | 'C++03 (ISO)' | 'C++11 (ISO)'
Default: For C, 'C99 (ISO)'; for C++ 'C++03 (ISO)'

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyValid library
Safety precautionNo impact

Related Topics