Mex compile problem on Mac 10.9

16 vues (au cours des 30 derniers jours)
James
James le 3 Oct 2014
I'm trying to compile a mex file for a mac. I already have compiled Windows versions, but I need to get a Mac version as well. However, when I try the mex command, I get the following:
Error using mex Undefined symbols for architecture x86_64: "_mexFunction", referenced from: -exported_symbol[s_list] command line option ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
The undefined symbols error isn't very useful in helping me find the problem. I've attached a text doc with the verbose output in the event it may prove useful for someone who knows what's going on. I also attached a zip file with a copy of the file being compiled.
Any help would be greatly appreciated.

Réponse acceptée

Geoff Hayes
Geoff Hayes le 3 Oct 2014
James - I tried compiling your code using R2014a with OS X 10.8.5 and observed the same error message
>> mex CCVSR.cpp
Building with 'Xcode Clang++'.
Error using mex
Undefined symbols for architecture x86_64:
"_mexFunction", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The function signature for mexFunction has been defined (in CCVSR.cpp) as
void mexFunction(int nOutp, mxArray *outp[], int nInp, mxArray *inp[])
which is almost correct, it is just missing the const on the last input parameter. If you replace the above line with
void mexFunction(int nOutp, mxArray* outp [], int nInp, const mxArray* inp [])
you should be able to compile/build the MEX function. (I was able to build it after this change was made.)

Plus de réponses (1)

James
James le 3 Oct 2014
Thanks! That seems to have dealt with the issue.

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by