From: Christine on
Problem: Linker can't find mx API functions.
System:
Mac OS 10.6.3, 64-bit
Matlab 2009b or 2010a (both maci64)
gcc/gfortran 4.4.1 from Fink

Mexopts:
----------------------------------------------------------------
-> MATLAB = /Applications/Scientific/MATLAB_R2009b.app
-> CC = /sw/bin/gcc-4
-> CC flags:
CFLAGS = -fno-common -no-cpp-precomp -m64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -fexceptions
CDEBUGFLAGS = -g
COPTIMFLAGS = -O2 -DNDEBUG
CLIBS = -L/Applications/Scientific/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = /sw/bin/g++-4
-> CXX flags:
CXXFLAGS = -fno-common -no-cpp-precomp -fexceptions -m64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -L/Applications/Scientific/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> FC = /sw/bin/gfortran
-> FC flags:
FFLAGS = -fdefault-real-8 -fdefault-double-8 -fexceptions -m64 -fbackslash
FDEBUGFLAGS = -g
FOPTIMFLAGS = -Os -funroll-loops -ftree-vectorize
FLIBS = -L/Applications/Scientific/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -L/sw/lib/gcc4.4/lib/x86_64/ -lgfortran -L/sw/lib/gcc4.4/lib/gcc/i686-apple-darwin10/4.4.1/x86_64/ -lgfortranbegin
arguments = -DMX_COMPAT_32
-> LD = /sw/bin/gcc-4
-> Link flags:
LDFLAGS = -Wl,-twolevel_namespace -undefined error -m64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -bundle -Wl,-exported_symbols_list,/Applications/Scientific/MATLAB_R2009b.app/extern/lib/maci64/fexport.map
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexmaci64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

The error:

-> /sw/bin/gcc-4 -O -Wl,-twolevel_namespace -undefined error -m64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -bundle -Wl,-exported_symbols_list,/Applications/Scientific/MATLAB_R2009b.app/extern/lib/maci64/fexport.map -o "FAST_SFunc.mexmaci64" DoubPrec.o SysMatlab.o NWTC_IO.o NWTC_Num.o NWTC_Aero.o NWTC_Library.o SharedInflowDefs.o HHWind.o FFWind.o FDWind.o CTWind.o UserWind.o InflowWindMod.o SharedTypes.o AeroMods.o GenSubs.o AeroSubs.o AeroDyn.o FAST_Mods.o Noise.o fftpack.o FFTMod.o HydroCalc.o AeroCalc.o FAST_IO.o FAST.o PitchCntrl_ACH.o SetVersion.o UserSubs.o UserVSCont_KP.o FASTSimulink.o FASTGateway.o -L/Applications/Scientific/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -L/sw/lib/gcc4.4/lib/x86_64/ -lgfortran -L/sw/lib/gcc4.4/lib/gcc/i686-apple-darwin10/4.4.1/x86_64/ -lgfortranbegin

Undefined symbols:
"_mxcopyptrtoreal8_", referenced from:
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
"_mxcopyreal8toptr_", referenced from:
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
"_mxcreatedoublematrix_", referenced from:
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
"_mxgetm_", referenced from:
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
"_mxgetn_", referenced from:
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
_mexfunction_ in FASTGateway.o
"_mxgetstring_", referenced from:
_mexfunction_ in FASTGateway.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

mex: link of ' "FAST_SFunc.mexmaci64"' failed.

??? Error using ==> mex at 221
Unable to complete successfully.