Making mex work with R2012b and MacOS 10.9.2

조회 수: 1 (최근 30일)
JC
JC 2014년 5월 2일
답변: Snehal 2025년 2월 21일
I can not compile some matlab functions in simulink model. I modify the mexopts.sh file
CC='llvm-gcc'
CXX='llvm-g++'
SDKROOT='/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/'
MACOSX_DEPLOYMENT_TARGET='10.9'
ARCHS='x86_64'
Here's the error comment:
/Applications/MATLAB_R2012b.app/bin/mex -c -O -DMATLAB_MEX_FILE -I/Applications/MATLAB_R2012b.app/toolbox/stateflow/stateflow/../../../simulink/include -I/Applications/MATLAB_R2012b.app/toolbox/stateflow/stateflow/../../../extern/include -I/Applications/MATLAB_R2012b.app/stateflow/c/mex/include -I/Applications/MATLAB_R2012b.app/stateflow/c/debugger/include simulation_sfun.c In file included from simulation_sfun.c:3: In file included from ./simulation_sfun.h:6: In file included from /Applications/MATLAB_R2012b.app/stateflow/c/mex/include/sfc_sf.h:33: In file included from /Applications/MATLAB_R2012b.app/toolbox/stateflow/stateflow/../../../simulink/include/mwmathutil.h:23: /Applications/MATLAB_R2012b.app/toolbox/stateflow/stateflow/../../../extern/include/tmwtypes.h:819:9: error: unknown type name 'char16_t' typedef char16_t CHAR16_T; ^ 1 error generated.
mex: compile of ' "simulation_sfun.c"' failed.
gmake: * [simulation_sfun.o] Error 1
Is it possible to make mex work with R2012b and MacOS 10.9.2 and Xcode 5.1.1 ? Thanks.

답변 (1개)

Snehal
Snehal 2025년 2월 21일
Hi @JC,
I understand that you are trying to compile some MATLAB functions using Simulink model in R2012b, MacOS 10.9.2 and Xcode 5.1.1.
The error:
>> unknown type name 'char16_t' typedef char16_t CHAR16_T; ^ 1 error generated.
>> mex: compile of ' "simulation_sfun.c"' failed.
That you're encountering is due to the char16_ttype not being recognized by the compiler. This issue often arises from using a compiler that's not fully compatible with the MATLAB/Simulink version.
list the Mac OS releases that are compatible with MATLAB R2012b. This document indicates support up to Mac OS X 10.8 for MATLAB R2012b, suggesting that Mac OS X 10.9.2 is not supported.
mentions the compiler versions supported by MATLAB R2012b, and as evident from the list, Xcode versions up to 4.6 are supported, but not Xcode 5.1.1.
This might be the reason for compilation failure that you’re encountering. It is suggested that you ensure using a combination of MATLAB/Simulink, OS (Mac OS X in this case) and Compiler (Xcode) versions such that they are mutually compatible as per the official documentation.
You can also refer to the following documentation for further details:
I hope this helps!

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by