Fix randomly seen problems with linking C++ programs.