S-Function Builder. Error using mex: error LNK2019 unresolved external symbol 'Function' referenced in function XXX_Output_wrapper
9 views (last 30 days)
I'm trying to use the S-Function builder to incorporate existing C code to perform an inverse kinematic routine for a robot. I include the header and source files like
The output of my S-Function is
clicking on the 'Build' button in the S-Function Builder gives no errors, however, on compiling the generated files using
mex -v A465_Inverse_Kinematics.c A465_Inverse_Kinematics_wrapper.c
I get the following error:
Error using mex
Creating library A465_inverse_kinematics.lib and object A465_inverse_kinematics.exp
A465_inverse_kinematics_wrapper.obj : error LNK2019: unresolved external symbol
A465_world_to_joint referenced in function A465_inverse_kinematics_Outputs_wrapper
A465_inverse_kinematics.mexw64 : fatal error LNK1120: 1 unresolved externals
Any ideas what is going wrong? I have the 'A465_world_to_joint' function in the 'Inv_kin.c' source file. Thanks for the help!
(using MSVS2012, MATLAB R2015b, 64bit Windows 10)
TAB on 7 Sep 2018
Edited: TAB on 7 Sep 2018
S-function builder builds and produce output mex file directly. Why you need to compile them seprately ?
In S-function builder --> On Build Info tab enable Show Compile Steps
Then give a build from S-function builder. After build is finished, open Simulink diagnostics viewer and analyse the build log. It will show which files are complied and linked exactly.
Then you can replicate same using mex function.