Documentation

Standard math library

Description

Specify standard math library for model.

Category:Code Generation > Interface

Settings

Default:C99 (ISO)or, ifLanguageis set toC++,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.

Tips

  • 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 toC89/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 specify this parameter for a Linux®gccbuild process, the software adds compiler flags to enforce the specified language standard. For example, if you set this parameter toC89/90 (ANSI), the software specifies:

    • For C code:-ansi -pedantic

    • For C++ code:-std=c++98 -pedantic

    If the build process includes custom code that does not conform with the version of the language standard, for example, custom C++ code that uses C++11 features, then the code might fail to compile.

    If your model is configured to use a toolchain for building code, use this workaround:

    1. In the Configuration Parameters dialog box, setBuild configurationtoSpecify.

    2. UnderToolchain details, in theC CompilerandC++ CompilerOptionsfields, replaceC_STANDARD_OPTSandCPP_STANDARD_OPTSwith your required compiler flags, omitting-pedanticand flags that specifies a language standard. You can determine default values forC_STANDARD_OPTSandCPP_STANDARD_OPTSby inspecting a previously generated makefile.

Dependencies

  • C++03is available for use only if you selectC++for theLanguageparameter.

  • When you change the value of theLanguageparameter, the standard math library updates toC99 (ISO)for C andC++03 (ISO)for C++.

Command-Line Information

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

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency Valid library
Safety precaution No impact

Related Topics