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_
Principiante
2.006 Vistas

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 Respuestas
mecej4
Colaborador Distinguido III
2.006 Vistas

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.

TimP
Colaborador Distinguido III
2.006 Vistas

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).

Responder