Here's a MWE (across two files) that causes the error when using the above linking...
Statically linking libstdc++ with gfortran giving errors