Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28150 Discussions

Warning #8889 Explicit declaration of the external attribute is required



I have just updated my FORTRAN compiler and am getting the warning above when I call MKL subroutines. I am including the MKL library automatically using the project properties tab. 

I searched online and am unable to find how I can fix this?

Many thanks for the help,

0 Kudos
5 Replies
Honored Contributor II
You need use mkl in the source to show the interface for the routine.
0 Kudos

Hi, thanks.

Do you mean just place:

include '' 

in the code?

If so, it is taking **much longer** to compile now... Any idea / reason why these warnings are popping up now? The code runs fine even with these warnings (as it did before I updated the Fortran compiler).

Also, I found a few instances of getting errors once I did " include '' " like this one:
error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic

Again, to clarify, this code has been running fine, without any of these errors or warnings until today, when

Many thanks,

0 Kudos
Black Belt

Instead of adding include '' to your source code, which causes compilation time to increase, you can build a module that provides the interfaces. Do the following steps once, for each target architecture.

  • Create a fixed form Fortran source file containing the lines 
          module mkl_m      
          include ''
          end module​
  • Compile the file, and place the resulting .mod file in ...\mkl\include\ia32 directory, if building for IA32 (and correspondingly for LP64 and ILP64).
  • In your Fortran source files that make MKL calls, instead of include '' add use mkl_m .

Regarding the warnings regarding passing a scalar when an array is expected, which result from the recent releases of the compiler doing more checking, you may ignore the warning if the code is working correctly, or change the declaration of the offending argument to make it an array. This problem usually arises when passing a place-holder argument that we know will never be referenced in the called MKL routine. Instead of 

real dummy
call mkl_routine(...,dummy,...)


real dummy(1)
call mkl_routine(...,dummy,...)
0 Kudos
Black Belt Retired Employee

My guess is that you are compiling from the command line and using /warn (or -warn) with no keywords. There's a new feature of Fortran 2018 called IMPLICIT NONE (EXTERNAL), which, if you specify it, requires that any procedure you call have the EXTERNAL attribute, which you typically get from an explicit interface. 

Similarly to how "/warn:declarations" implies IMPLICIT NONE for all compilations, the new "/warn:external" implies IMPLICIT NONE (EXTERNAL). If you want to disable this, change your /warn option either to specify just the options you want, or use "/warn:all,noexternal" or "-warn all,noexternal"