Compiling S Function Error

When I try to compile s function, I got an error.
Error using mex
C:\Users\Aman\AppData\Local\Temp\mex_144915910790007_18676\FAST_SFunc.obj:FAST_SFunc.c:(.text+0x1183): undefined reference to
collect2.exe: error: ld returned 1 exit status

Error in create_FAST_SFunc (line 7)
mex -v -L…/…/bin -lFAST_Library_x64 …

Dear @Aman.Ali ,

I’m not familiar with that error. Which version of FAST or OpenFAST are you trying to compile?

Best regards,

Dear @Jason.Jonkman
I am using FAST_v8.16.00a-bjj version.

Dear @Aman.Ali,

Are you not able to use the precompiled S-Function for FAST v8.16 that is provided with the archive, e.g., because you’ve changed the source code or have an operating system other than Windows?

Best regards,

Dear @Jason.Jonkman

I didn’t change anything in the source file. I just want to run sample file Run_OpenLoop.m, but I got the error.

Error using Run_OpenLoop (line 30)
Error reported by S-function ‘FAST_SFunc’ in ‘OpenLoop/FAST Nonlinear Wind Turbine/S-Function’:

Dear @Aman.Ali,

Can you share the full message from the MATLAB workspace when you try to run the sample file Run_OpenLoop.m? In your related post (problem with FAST on MATLAb/Simulink - #14 by Jason.Jonkman), it sounded like your problem was regarding the use of 32-bit controller with a 64-bit version of Simulink.

Best regards,

Dear Sir,

I shared the error in this link (

I’ve responded there.