MATLAB: Do I receive the error, “libstdc++.so.6: version `GLIBCXX_3.4.22′ not found” when trying to start MATLAB on Ubuntu 18.04

Why do I receive the error below when trying to start MATLAB?
usr/local/MATLAB/R2018b/bin/glnxa64/MATLAB: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/local/MATLAB/R2018b/bin/glnxa64/libmwms.so)
/usr/local/MATLAB/R2018b/bin/glnxa64/MATLAB: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/local/MATLAB/R2018b/bin/glnxa64/libmwmst.so)
/usr/local/MATLAB/R2018b/bin/glnxa64/MATLAB: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/local/MATLAB/R2018b/bin/glnxa64/libCppMicroServices.so.3.3.1)
 

Best Answer

The libstdc++ library shipped with Ubuntu 18.04 may be older and may not contain the required GLIBCXX version that MATLAB requires.
To resolve this issue you may upgrade the libstdc++ libraries by running the following command as they appear:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
OR 
Use MATLAB's libraries by setting the environment variable:
export LD_LIBRARY_PATH=/usr/local/MATLAB/R2018b/sys/os/glnxa64
Then attempt to open MATLAB again. 
Related Question