Undefined reference to `ssFxpSetU​32BitRegio​nCompliant​' and `ssRegiste​rDataTypeF​xpBinaryPo​int'

2 次查看(过去 30 天)
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 个评论
Arvindh Ram Ganapathi Raman
I couldn't solve it directly, I worked around by splitting 64 bit variables into 2 32 bit variables and working with that. Sadly I could find no help regarding this on the internet. Let me know if you solved it the right way somehow.

请先登录,再进行评论。

回答(1 个)

Narvik
Narvik 2024-1-24
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!

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by