We recommend you to use the grouping symbols to be used when linking with IntelMKL.
An example of link line with grouping symbols are mentioned below.
-Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a $(MKLROOT)/lib/intel64/libmkl_core.a -Wl,--end-group -openmp -lpthread
If you specfiy thelibrarieswithin a group, theyare searched multiple times to resolve cross references within the libraries. Normally, cross references are only resolved within a library, that is the library that is searched multiple times. Libraries specified later on the link line cannot reference otherwise unreferenced symbols in libraries specified earlier, because the linker has already handled them. Library groups are a solution for this problem, because the linker will search repeatedly through all libraries specified in the group, until all possible open symbol references have been satisfied.