Search code examples
c++matlabmex

Calling MATLAB from C++ dyld: Library not loaded error


I'm trying to run the following example found at http://www.box.net/shared/xmazi14uv2.

But when I make and try to run the executable, I encounter the following error:

./demo
dyld: Library not loaded: @rpath/libeng.dylib

I've had no success searching the web. I'm running MATLAB_R2014b on a MacBook Pro Air.


Solution

  • I don't use or even have access to a Mac, but I think you need to setup some environment variables when you run applications using the MATLAB Engine:

    export PATH='/path/to/MATLAB_R2014b.app/bin':$PATH
    
    export DYLD_LIBRARY_PATH='/path/to/MATLAB_R2014b.app/bin/maci64:/path/to/MATLAB_R2014b.app/sys/os/maci64':$DYLD_LIBRARY_PATH