To whom it may concern,
I am having trouble using the s-function builder application to build a mex file for use in simulink. I wish to include a class definition and header similar to that seen in the included in the included example permutation (found here open_system('sfbuilder_permutation')). This example builds fine with no problems on my computer (windows 10, Matlab R2017B, visual studio 2017 c/c++ compiler).
The problem is that when I build even the simplest class, and link it, I get the following error: c:\scratch\working code projects\simulink\blarg2\BLARG2.hpp(1): error C2061: syntax error: identifier 'BLARG2'
Without trying to lead the witness, this appears to be an error thrown by Visual Studio not recognising the identifier "class". It is parsing the files as if they were c files.
I can remedy this error by manually taking the output .c and .h files, renaming them as .cpp and .hpp files and compiling using mex from the command window. Howcome the matlab example permutation generates the correct .cpp and .hpp files (see below)?
I have included a very simple example, where only only the header for the class BLARG2 is being included, and an object is not even instantiated and pointed to by pWork. Any thoughts why this is happening?
Thank you in advance,