S-Function Builder. Error using mex: error LNK2019 unresolved external symbol 'Function' referenced in function XXX_Output_wrapper

5 次查看(过去 30 天)
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)

回答(1 个)

TAB
TAB 2018-9-7
编辑:TAB 2018-9-7
S-function builder builds and produce output mex file directly. Why you need to compile them seprately ?
However....
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.

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by