MATLAB Answers

0

How to build an S-function with nested C++ source code? (The source code has a lot of folders and sub-folders)

Rachit Shah 님이 질문을 제출함. 16 Oct 2018
최근 활동 Rachit Shah 님이 편집함. 19 Oct 2018
I have tried finding helpful resources but I just got this one https://www.mathworks.com/help/simulink/examples/custom-code-and-hand-coded-blocks-using-the-s-function-api.html However, I could not find a description about this example. Can someone explain it a bit? Some basics and entry level pointers would be really helpful. Thanks!

  댓글 수: 0

로그인 to comment.

태그

제품


릴리스

R2016b

답변 수: 2

Answer by TAB
on 17 Oct 2018

There are multiple ways to integrated you leagcy c/c++ code into a s-function. Please check below references

  댓글 수: 0

로그인 to comment.


Answer by Rachit Shah on 19 Oct 2018
Edited by Rachit Shah on 19 Oct 2018

Ok, following the 1st tutorial (legacy_code_tool). I have a 'def' variable structure with c++ source & header files. However, I am seeing a few errors when I compile:

error C2504: 'DATLib': base class undefined
error C2061: syntax error: identifier 'DATLibOutput'
error C2535: 'SPPLibrary::SPPLibrary(void)': member function already defined or declared
error C2143: syntax error: missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2238: unexpected token(s) preceding ';'
error C3668: 'SPPLibrary::setConfiguration': method with override specifier 'override' did not override any base class methods

Am I missing a support package for C++? The code compiles on its own. (Using Visual Studio 2015 Enterprise to compile)

  댓글 수: 0

로그인 to comment.



Translated by