If I understand properly the idea behind the API is to be able to pass some data back and forth from C++ and MATLAB (provided the MATLAB environment is up and running on the computer) to get the best of both worlds.
Concretely what I am trying to do is to use the API in a simulation code as to not have to open MATLAB manually every time I want to get plots from my C++ program. I understand there are other options such as compiling directly using mex in MATLAB (which I haven't been able to do because as I execute the compiled file it cannot load the shared libraries properly)...
For starters, I have been trying to execute the example (engdemo.cpp) provided by MATLAB.
I tried updating my makefile to include the libraries and references to the necessary header files:
MATLABROOT = /.../matlab/r2012b
CFLAGS = -I${MATLABROOT}/extern
LIBS = -L${MATLABROOT}/bin/glnxa64
Then g++ $(CFLAGS) $(LIBS) -leng -lmx demo.cpp -o demo
But I get a bunch of warnings about libeng and libmx not being able to find other *.so files.
When I manually checked the folder containing the *.so (namely .../bin/glnxa64) I've realized they were not called -leng and -lmx but libeng and libmx.
1) So first of all I would like to know why I have to call them in a different way?
The warning messages advised me to use the -rpath or -rpath-link option which I guessed was some kind of recursion, which I don't understand because all the *.so are in the same folder. I still tried and it didn't work because the option would not be recognized. I therefore tried to manually request the execution of the other *.so and it worked for some of them but not all and I still didn't understand at that point why should they be called as -l*** insted of -lib***.
2) So my second question is, what can I do to solve this issue or is there an easy way to run this example?