未知类型char16_t: MATLAB 2013a, Xcode 5.1, OS X 10.9。

时间:2021-10-02 01:26:37

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:

但当我试图编译一个Simulink文件时,问题仍然存在。我的mexopts。可以在这里找到sh文件。我修改mexopts。sh,我保存了文件并运行了mex设置。我从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...

另外,我尝试将“代码生成选项”中的“语言”设置为c++而不是C。我还尝试在代码生成>定制代码>头文件中添加类型定义,即typedef uint16_t char16_t;我还尝试在CXXFLAGS中添加-Dchar16_t=uint16_t,但问题仍然是…

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

我在Mac OS X 10.9, Xcode 5.1.1和MATLAB 2013a上运行。

1 个解决方案

#1


0  

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

尝试这里的答案:MEX编译错误:未知类型名称“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."

这对我很有效:“将-std=c++11添加到您当前的墨西哥卷中CXXFLAGS。和编译。cpp文件而不是。c。(更新:这是有效的)。一些其他的选择。”

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

祝你好运…我想让Matlab 2012a在我的Mac OS X 10.9上工作…

#1


0  

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

尝试这里的答案:MEX编译错误:未知类型名称“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."

这对我很有效:“将-std=c++11添加到您当前的墨西哥卷中CXXFLAGS。和编译。cpp文件而不是。c。(更新:这是有效的)。一些其他的选择。”

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

祝你好运…我想让Matlab 2012a在我的Mac OS X 10.9上工作…