我讀過這些問與答&作爲:未知類型char16_t:MATLAB 2013a時,Xcode 5.1,OS X 10.9
- MEX compile error: unknown type name 'char16_t'
- Mex files using Xcode 5.1 under OS X 10.9 with MATLAB 2012a
但是當我嘗試問題仍然存在編譯一個Simulink文件。我的mexopts.sh
文件可以找到here。我修改了mexopts.sh
,我保存了該文件並運行了mex -setup
。我從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
此外,我試圖設置「語言」在我的「代碼生成選項」到C++而不是C.我也試圖在Code Generation > Custom Code > Header File
添加類型定義,是typedef uint16_t char16_t;
我也試圖在CXXFLAGS中添加一個-Dchar16_t=uint16_t
,但問題依然存在......
我在Mac OS X 10.9,Xcode 5.1.1和MATLAB 2013a上運行。