I've read these Q&As:
- MEX compile error: unknown type name 'char16_t'
- Mex files using Xcode 5.1 under OS X 10.9 with MATLAB 2012a
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.