1

I've read these Q&As:

but the problem still remains when I try to compile a Simulink file. My mexopts.sh file can be found here. I modified mexopts.sh, I saved the file and ran mex -setup. I get the following error from Simulink:

Making simulation target "MySimulator_sfun", ... 


/Applications/MATLAB_R2013a.app/bin/mex -c -O  -DMATLAB_MEX_FILE    -I/Applications/MATLAB_R2013a.app/stateflow/c/mex/include -I/Applications/MATLAB_R2013a.app/stateflow/c/debugger/include   MySimulator_sfun.c
In file included from MySimulator_sfun.c:3:
In file included from ./MySimulator_sfun.h:6:
In file included from /Applications/MATLAB_R2013a.app/stateflow/c/mex/include/sfc_sf.h:33:
In file included from /Applications/MATLAB_R2013a.app/simulink/include/mwmathutil.h:23:
/Applications/MATLAB_R2013a.app/extern/include/tmwtypes.h:819:9: error: unknown
      type name 'char16_t'
typedef char16_t CHAR16_T;
        ^
1 error generated.

    mex: compile of ' "MySimulator_sfun.c"' failed.

gmake: *** [MySimulator_sfun.o] Error 1

Additionally, I tried to set the 'Language' in my 'Code generation options' to C++ instead of C. I also tried to add a type definition at Code Generation > Custom Code > Header File, that is typedef uint16_t char16_t; I also tried to add a -Dchar16_t=uint16_t in CXXFLAGS, but the problem remains...

I'm running on Mac OS X 10.9, Xcode 5.1.1 and MATLAB 2013a.

Community
  • 1
  • 1
Pantelis Sopasakis
  • 1,902
  • 5
  • 26
  • 45

1 Answers1

0

Try the answer here: MEX compile error: unknown type name 'char16_t'

This worked for me: "Add -std=c++11 to CXXFLAGS in your current mexopts.sh. AND compile .cpp files instead of .c. (UPDATE: this is what worked). Some other options follow."

Good luck... I'm trying to get Matlab 2012a to work on my Mac OS X 10.9...

Community
  • 1
  • 1