4

I am trying to use the MATLAB Engine to invoke some MATLAB functions from C++ on MAC-OSX El Capitán. I've seen similar posts but none of them explains the situation calmly in a way that unprofessional people might understand. Can someone give me an simple explanation and easy fix?

I get the following error message at runtime:

dyld: Library not loaded: @rpath/libeng.dylib
Referenced from: /Users/Admin/Desktop/cpp_to_matlab/./engdemo
Reason: image not found
Trace/BPT trap: 5
Alexis R Devitre
  • 288
  • 2
  • 6
  • 21
  • 1
    You need a copy of `libeng.dylib` in the same directory as the program `engdemo`. I'm guessing that `libeng.dylib` is some matlab library. TBH you need to show the compilation error that's indicating this issue; as that error pretty much only shows up at run-time. – Anya Shenanigans Feb 17 '16 at 14:10
  • 1
    When you compile? Not when you run the executable? Use [this answer](http://stackoverflow.com/a/12522096/299924) to show us the runpath of the executable (update your question). – trojanfoe Feb 17 '16 at 14:12
  • @trojanfoe The problem happens at execution time. The compilation is completed without complaints. Also I tried to run both "otool -1" after the execution and "otool -1 engdemo" before that but I don't get any runpath description. How should I run this routine? – Alexis R Devitre Feb 18 '16 at 02:29
  • @Petesh That didn't do... – Alexis R Devitre Feb 18 '16 at 03:20
  • @AlexisRustamDevitre That's `-l` not `-1`. – trojanfoe Feb 18 '16 at 07:04
  • @AlexisRustamDevitre Check solutions from this [question](http://stackoverflow.com/questions/1937232/linking-to-a-dynamic-library-on-a-mac-with-full-path). The issue seems to point at relative vs. absolute paths problem. – durasm Feb 18 '16 at 08:08
  • @trojanfoe hahahaha....yeah clearly it's -l... I feel so dumb haha – Alexis R Devitre Feb 18 '16 at 08:43

1 Answers1

1

I found the answer here. I was missing a whole bunch of libraries, but somehow the compiler/runtime never said anything about those...

Alexis R Devitre
  • 288
  • 2
  • 6
  • 21