ERROR LNK2019 When Compiling a Simulink® Model for VeriStand

Updated Dec 6, 2018

Reported In

Software

  • VeriStand

Issue Details

I'm using The Mathworks, Inc. Simulink® to compile a Model for Veristand environment.
When I try to fill up a simple model using Simulink® MIN_MAX function, I get back ERROR LKN2019:
"untitled.obj: error LNK2019: unresolved external symbol _fmin referenced in function _untitled_output”

Solution

The reason for this is that the model has the Target function library set to C99. FMIN and FMAX are C99 but will not compile with a C89/90 compiler.
To be able to build your code with a C89/C90 compiler you need to update the model to use e.g. the C89/C90 Target function library.

Please follow this instructions:

1. Open the "Configuration Parameters" and navigate to the “Code Generation” > “Interface” section.

2. Under “Software environment” you will find the option to set a Target function library. Select e.g. C89/C90 to generate code that does not use FMIN/FMAX.
 

Additional Information

MATLAB® Function block that uses the functions MIN and MAX generates code that includes calls to the functions FMIN and FMAX respectively.
When compiling, it  fails as FMIN / FMAX are unknown.

This behavior could also be associated with other MATLAB® Error related to the generation of code that includes calls to the S-functions