MATLAB: Mex compile problem on Mac 10.9

MATLABmex

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.

Best Answer

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.)
Related Question