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

1 回表示 (過去 30 日間)
Adrian Bedford
Adrian Bedford 2016 年 1 月 13 日
回答済み: Pavithra Ashok Kumar 2016 年 1 月 19 日
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
Pavithra Ashok Kumar 2016 年 1 月 19 日
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 Center および File ExchangeBlock and Blockset Authoring についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by