Building non-inlined S-function with .c file present alongside the .cpp is causing Simulink (with Matlab R2015a) to use the .c file in the build process for the model even though the actual .mexw64 file was generated for C++.

1 次查看(过去 30 天)
I had built a .cpp S-function with mex. After generating the code for the model, the built .exe kept crashing. So after some digging, I went into the debugger and noticed it is calling a non-existent mdlStart() in the .exe. There was a mdlStart() in my .cpp file, but the dummy .c file which was also present didn't have it and it was the .c file for some reason that was compiled during the build process, even though the .mexw64 file I had generated was for the .cpp file. Is this a bug?
  1 个评论
Jordan Ross
Jordan Ross 2016-9-23
Hi Raghu,
In your model configuration parameters, do you have the code generation language selected to be C or C++?
Since your S-function is compiled in C++, I would try setting the code generation language to C++ in the model configuration parameters.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Block and Blockset Authoring 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by