Using simulink to call c++ code via an s-function

1 次查看(过去 30 天)
I am trying to duplicate this example: http://uk.mathworks.com/matlabcentral/answers/102682-how-can-i-generate-an-s-function-that-calls-a-c-static-library-with-other-library-dependencies I get the following error: Mult_lib.lib(mult_cpp.obj) : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@YAXPAXI@Z) referenced in function "void __cdecl deleteMult(void)" (?deleteMult@@YAXXZ) my_lib_adder_cpp.mexw32 : fatal error LNK1120: 1 unresolved externals Can you help please?

回答(1 个)

Pavithra Ashok Kumar
The issue may occur because of a mismatch in code settings. The library and associated header file should be included in both the Custom Code section for Simulation Target and under Code Generation. Simulation modes that use code generation (such as Accelerator mode) will still work as the Simulation Target includes are set up correctly.
Under the Code Generation -> Custom Code section, the option for "Use the same custom code settings as Simulation Target" can be selected. Hope this resolves your issue.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by