I\'m trying to learn how to use the C API to reading Matlab .mat
files, but it\'s not working as I expected:
I\'d like to just open a very simple
This is a linker failure, not a compiler failure (and is unrelated to -I
compiler option). You need to specify the directory in which the matlab .so
files are located using -L
flag and add a -l<matlab-lib-name>
option to end of the compiler command that specifies the name of the matlab library.
For example:
cc -I/usr/local/MATLAB/R2011a/extern/include/ -L/usr/local/MATLAB/R2011a/lib animate_shot.c -o animate_shot -lmatlab
(I don't know the exact directory into the which .so are located or the name of the matlab library)
Based on the comment providing further information:
cc -I/usr/local/MATLAB/R2011a/extern/include/ -L/usr/local/MATLAB/R2011a/bin/glnxa64 animate_shot.c -o animate_shot -lmat -lmx