Error compiling mex with R2013b in OSX 10.9
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone, I want to get started using mex files so I started reading a book on it and can't even get the very first examples to compile. The code is below.
------------------------------------------------------
#include "mex.h"
void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray *prhs[])
{
mexPrintf("Hello, mex!\n");
}
------------------------------------------------------
And I get the following error message.
------------------------------------------------------
In file included from helloMex.cpp:1:
In file included from /Applications/MATLAB_R2013b.app/extern/include/mex.h:58:
In file included from /Applications/MATLAB_R2013b.app/extern/include/matrix.h:252:
/Applications/MATLAB_R2013b.app/extern/include/tmwtypes.h:831:9: error:
unknown type name 'char16_t'
typedef char16_t CHAR16_T;
^
1 error generated.
mex: compile of ' "helloMex.cpp"' failed.
------------------------------------------------------
I am running MATLAB 2013b under OS X 10.9 and I have Xcode 5.1 beta 5 installed. I'm wondering if this is a bug due to the beta version of Xcode, but I was wondering if anyone else has seen this problem. Any thoughts welcome.
2 commentaires
Ken Atwell
le 24 Fév 2014
A stab in the dark: If you rename HelloMex.cpp to HelloMex.c (that is, C compilation rather then C++), what happens?
Bob
le 18 Mar 2014
A different question up here at TMW Answers related to compilation issues suggested downgrading Xcode to v5.02, from 5.1. I just did this (MATLAB 2012b and OS X 10.9.2) and ... it worked. Old versions are in: developer.apple.com/ Good luck!
Réponses (2)
Jon C
le 15 Avr 2014
Modifié(e) : Jon C
le 17 Avr 2014
Rather than downgrading Xcode, there are a few solutions listed on this page. The first thing to try if you can use C++ rather than just C is to add
-std=c++11
to CXXFLAGS in your current mexopts.sh.
Or if you have to use C only or can't enable C++11, try one of the alternative solutions given here. One way that seems to work is adding this to the `mex` command line:
-Dchar16_t=UINT16_T
Voir également
Catégories
En savoir plus sur Troubleshooting in MATLAB Compiler SDK dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!