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

undefined reference to `derf'

xiaoming_l_
Beginner
1,521 Views

I compile others' codes ,I find it have a function below, I compile .......

Double Precision Function myderf(a)
Implicit None
Double Precision a
Double Precision derf
External derf
myderf=derf(a)

Return

End Function myderf

I got errors

ze_i386.o: In function `myderf_':
ze_i386.f90:(.text+0x1b): undefined reference to `derf'
ze_i386.o: In function `myderfc_':
ze_i386.f90:(.text+0x3b): undefined reference to `derfc'

why ?  need  I  link something ?

0 Kudos
2 Replies
mecej4
Honored Contributor III
1,521 Views

ERF, DERF and QERF are intrinsic functions, not external functions. Either change "External" to "Intrinsic" or comment out the statement altogether.

Similar remarks apply to ERFC.

0 Kudos
TimP
Honored Contributor III
1,521 Views

I agree with mecej4.  external derf states that you will supply an implementation of derf and that you don't want to use the Fortran built-in (erf preferred).   Inclusion of erf in the Fortran intrinsic list is a relatively recent change, so you may still be able to find old compilers which prefer the way you have presented it (but you are then likely to need to link specifically against a library which provides derf).

0 Kudos
Reply