I am going to use the shared MATLAB library in my QT program.
- OS: Ubuntu 15.10
- MATLAB Version: MATLAB 2015b
- QT Version: QT 5.5.1
I am writing a simple MATLAB function.
function a = libcalsin(b)
a = b + 4;
end % end of function
Then I use the MATLAB Library Compiler to generate the .so and .h files.

So, the output files are: libcalsin.so and libcalsin.h. I copy these files to my QT project and add the libcalsin library to my QT project using the QT Creator Add Library function. Therefore, the following lines are automatically added to my .pro file:
unix:!macx: LIBS += -L$$PWD/./ -lcalsin
INCLUDEPATH += $$PWD/.
DEPENDPATH += $$PWD/.
In this step, I installed MATLAB 2015 and added the runtime library path using the export command:
export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64:
and then add the following line to my .pro file:
unix:!macx: LIBS += -L/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64/ -lmwmclmcrrt
INCLUDEPATH += /usr/local/MATLAB/MATLAB_Runtime/v90/extern/include
DEPENDPATH += /usr/local/MATLAB/MATLAB_Runtime/v90/extern/include
But when I run my program, I encounter the following runtime error:
An Error has occurred while trying to initialize the MATLAB Runtime.
The error is: Fatal error loading library /usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64/libmat.so Error: /usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64/libicuio.so.54: undefined symbol: _ZN6icu_5413UnicodeString9doReplaceEiiPKDsii