Mex compile problem on Mac 10.9

16 次查看(过去 30 天)
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.

采纳的回答

Geoff Hayes
Geoff Hayes 2014-10-3
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.)

更多回答(1 个)

James
James 2014-10-3
Thanks! That seems to have dealt with the issue.

类别

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