You can't mix libraries between 10.0 and 12.1 compilers. You should let the compiler choose consistent libraries. It might be better to adhere closer to the link advisor as a starting point, even if you are serious about eventually using a mixture of static and dynamic MKL libraries.ifort failing to find -limf would appear to indicate that you didn't set the environment variables by sourceing the compilervars script.

libimfis the math libraryfromIntel compiler. Did you correctly use compilervarsto setyour environment? Or add -L path to compiler libs location.Also, if your code is inC++ then you don't need to link with -lstdc++ and try C++ compiler.