MATLAB: How to fix “undefined reference” link error on Ubuntu 16 with MATLAB R2016b and earlier

16MATLABmexr2016breferenceUbuntuundefined

How do I fix "undefined reference" link error on Ubuntu 16 with MATLAB R2016b and earlier?

Best Answer

If your application myprog.c uses new gcc 5.3 features and you get a link error, use the following mex command options:  
mex -client engine myprog.c MWCPPLIB=''