Version `GLIBCXX_3.4.22' not found
You could try to use pinning to make sure only the packages you want are updated to a newer version.
Alternatively, you could simply compile your program with g++ 5.4, because according to this page, this compiler already supports all c++14, the only difference is that g++-6 defaults to -std=c++14, whereas with g++-5 you have to set the language standard explicitly.
You need to upgrade libstdc++6 to latest version like this
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
After that you can check if you get GLIBCXX desired version like this:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX