# S-Function Compiling

**URL:** <https://forums.nlr.gov/t/s-function-compiling/1210>\
**Category:** Computer-Aided Engineering Software Tools\
**Created:** [October 23, 2015, 8:34am UTC](https://forums.nlr.gov/t/s-function-compiling/1210 "2015-10-23T08:34:55Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Iman.Yousefi](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@Iman.Yousefi](https://forums.nlr.gov/u/Iman.Yousefi)\
**Post date:** [October 23, 2015, 8:34am UTC](https://forums.nlr.gov/t/s-function-compiling/1210/1 "2015-10-23T08:34:55Z")

</div>

Hello!

I recently installed MATLAB R2015b, and also downloaded the latest version of FAST.

I need to run the simulations in Simulink, however due the different MATLAB version which is used to compile, I need to re-compile the .mex file. For that, I installed MinGW-w64 from mathworks; but still I have a problem in compiling. The script I used to compile .mex file is the one which is contained at FAST folder:

mex -v -L…/…/bin -lFAST\_Library\_x64 …  
-I…/…/Source -I…/…/Source/dependencies/OpenFOAM -outdir …/…/bin COMPFLAGS=‘$COMPFLAGS /MT’ FAST\_SFunc.c

Which will be resulted in the following error at the middle of compiling:

Error using mex  
C:\Users\Iman\AppData\Local\Temp\mex\_14669147854515\_112\FAST\_SFunc.obj:FAST\_SFunc.c:(.text+0xe67):  
undefined reference to `min’  
collect2.exe: error: ld returned 1 exit status

Error in create\_FAST\_SFunc (line 7)  
mex -v -L…/…/bin -lFAST\_Library\_x64 …

Please let me know how I can correct it.

Yours,  
Iman

---

_[View the full topic](https://forums.nlr.gov/t/s-function-compiling/1210)._
