title: mex linker not finding mexFunction symbol
body: <p>Up until recently I've been able to compile mex functions fine on my mac osx 10.8.4
  but now it gives me the error as follows (for convenience I have included the entire -v invocation):</p>
  
  <pre><code>**************************************************************************
  Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected. 
  Using -compatibleArrayDims. In the future, MATLAB will require
  the use of -largeArrayDims and remove the -compatibleArrayDims
  option. For more information, see:
  http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-    
  api.html
  **************************************************************************
  
  -&gt; mexopts.sh sourced from directory (DIR = .)
   FILE = /Users/munanxu/Dropbox/Code/CUDA/mexThomasTDM/mexopts.sh
  ----------------------------------------------------------------
  -&gt;    MATLAB                = /Applications/MATLAB_R2013a.app
  -&gt;    CC                    = xcrun  -sdk macosx10.7  clang
  -&gt;    CC flags:
           CFLAGS             = -fno-common -arch x86_64 -isysroot   
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOS
  X10.7.sdk -mmacosx-version-min=10.7  -fexceptions
       CDEBUGFLAGS        = -g
       COPTIMFLAGS        = -O2 -DNDEBUG
       CLIBS              = -L/Applications/MATLAB_R2013a.app/bin/maci64 -lmx -lmex -lmat - 
       lstdc++
       arguments          =  -DMX_COMPAT_32
  -&gt;    CXX                   = xcrun  -sdk macosx10.7  clang++
  -&gt;    CXX flags:
        CXXFLAGS           = -fno-common -fexceptions -arch x86_64 -isysroot 
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX
  10.7.sdk -mmacosx-version-min=10.7
       CXXDEBUGFLAGS      = -g
       CXXOPTIMFLAGS      = -O2 -DNDEBUG
       CXXLIBS            = -L/Applications/MATLAB_R2013a.app/bin/maci64 -lmx -lmex -lmat -
  lstdc++
       arguments          =  -DMX_COMPAT_32
  -&gt;    FC                    = gfortran
  -&gt;    FC flags:
       FFLAGS             = -fexceptions -m64 -fbackslash
       FDEBUGFLAGS        = -g
       FOPTIMFLAGS        = -O
       FLIBS              = -L/Applications/MATLAB_R2013a.app/bin/maci64 -lmx -lmex -lmat -L    
  -lgfortran -L -lgfortranbegin
       arguments          =  -DMX_COMPAT_32
  -&gt;    LD                    = xcrun -sdk macosx10.7 clang
  -&gt;    Link flags:
       LDFLAGS            = -arch x86_64 -Wl,-        
  syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/
  SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -bundle -Wl,-  
  exported_symbols_list,/Applications/MATLAB_R2013a.app/extern/lib/maci64/mexFunction.map
       LDDEBUGFLAGS       = -g
       LDOPTIMFLAGS       = -O
       LDEXTENSION        = .mexmaci64
       arguments          = 
  -&gt;    LDCXX                 = 
  -&gt;    Link flags:
       LDCXXFLAGS         = 
       LDCXXDEBUGFLAGS    = 
       LDCXXOPTIMFLAGS    = 
       LDCXXEXTENSION     = 
       arguments          = 
  ----------------------------------------------------------------
  
  -&gt; xcrun -sdk macosx10.7 clang -g -arch x86_64 -Wl,-  
  
  syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/
  SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -bundle -Wl,-
  exported_symbols_list,/Applications/MATLAB_R2013a.app/extern/lib/maci64/mexFunction.map -o  
  "inputsTest.mexmaci64"   "inputsTest.o"  -L/Applications/MATLAB_R2013a.app/bin/maci64 -lmx 
  -lmex -lmat -lstdc++
  
  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
  </code></pre>
  
  <p>I had copied the original mexopts.sh file to the local directory to ensure that the mex compiler was using the correct version. I had also previously compiled my cpp file using g++ just to make sure the code was compiled natively for the x86_64 architecture. However, the same result occurs when I attempt to use the mex compiler to do compilation and linking. 
  Any ideas on what might be going on here? It seems that people have had this issue before, but mostly with missing libraries or definitions. I have definitely defined a mexFunction in my source file.</p>