Undefined reference to `ssFxpSetU32BitRegionCompliant' and `ssRegisterDataTypeFxpBinaryPoint'
2 views (last 30 days)
Show older comments
Hi,
I am trying to compile a MEX file from a set of C source code files from our project. In the output specification function of the S function, I have defined 64 bit output parameter.
I had created a legacy code C file which acts as a wrapper to the source code files and tried compiling it along with other source code files with the command mex src1.c src2.c, ..... etc..,
On compiling the mex file, I get Undefined reference to `ssFxpSetU32BitRegionCompliant' and Undefined reference to `ssRegisterDataTypeFxpBinaryPoint' errors.
I had inspected the legacy code generated C file and it already has the fixedpoint.h included which has the function definition for `ssFxpSetU32BitRegionCompliant' and `ssRegisterDataTypeFxpBinaryPoint'.
It is strange that there is error eventhough the fixedpoint.h file is included. I am using R2019b version.
Thanks
3 Comments
Danilo Teran
on 22 Jul 2022
Hi
could you solve it ? i have the same problem and dont know how to resolve it
thanks for your help =)
Answers (1)
Narvik
on 24 Jan 2024
Hi,
As per my understanding, you are trying to compile a MEX file and facing issues. The errors you are seeing “Undefined reference to ssFxpSetU32BitRegionCompliant” and “Undefined reference to ssRegisterDataTypeFxpBinaryPoint” typically indicate a linking problem. In C and C++, an “undefined reference” error occurs when the linker is unable to find the implementation of a function or a symbol.
Since you mentioned that you included the fixedpoint.c and fixedpoint.h files in your S-function, you can try passing an extra argument “lfixedpoint” to the mex command. For example:
>> mex sfun_user_fxp_asr.c -lfixedpoint
The argument "-lfixedpoint" tells the MEX compiler to link against the fixedpoint library when creating the MEX-file. Refer to
matlabroot/toolbox/simulink/fixedandfloat/fxpdemos/mex_sfun_user_fxp_examples.m
file for more information on the same.
The following documentation provides more information on creating MEX files:
Hope this helps!
0 Comments
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!