0

I am trying to run a Simulink file which contain S-functions along with other Simulink blocks in rapid accelerator mode. When tried to build the executable I am getting a error to change the compiler from LCC to supported compilers.

Note: Matlab documentation suggests lcc compilers are incompatible with S-functions

Steps tried:

Running mex -setup I was able to select MSVS compiler already installed in my computer. But again while trying to build for rapid accelerator target, Simulink is taking LCC compiler pre-installed with its installation.

Can anyone suggest a work-around, what I am expecting is:

-Ways to change the default compiler (LCC) to another compiler preferably MSVS (installed) for building Rapid Acceleration target -Ways of overriding the LCC selection by Simulink to another compiler selection.

Akhil Nandan
  • 315
  • 2
  • 9
  • Did you change both the C compiler and the C++ compiler with `mex setup`? By default it sets only the C compiler, there should be links to other languages when you do that though. – Cris Luengo May 25 '23 at 04:09
  • @CrisLuengo I think you might be right. I did change the C compiler but may have left the C++ compiler to configure. Thanks! – Akhil Nandan May 25 '23 at 04:37
  • @CrisLuengo Thanks a lot it worked. Brain fade for me. My bad! – Akhil Nandan May 25 '23 at 05:26
  • Wonderful! Please add an answer so that other people with this issue can find it! These comments can be deleted easily. – Cris Luengo May 25 '23 at 13:12

1 Answers1

0

Background:The default compiler for C++ in Simulink is lcc which is packaged with the installation. According to Supported compilers in matlab it is observed that lcc doesn't S-functions and have to select another compiler installed in the system. In my case MSVS2015 satisfied all my model requirements.

To change the default compiler run

mex -setup c and mex -setup c++ to change the C and C++ compilers.

Solution:For my above question I had forgot to set C++ compiler and only changed C compiler to MSVS which caused the erroneous runs.

Akhil Nandan
  • 315
  • 2
  • 9