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

pfxlocaltime

vivekrao4
Beginner
491 Views

Compiling the code below, which calls pfxlocaltime, a POSIX extension, in both the main program and in the module, using just "ifort xtemp.f90",

module file_time_mod
implicit none
private
public :: foo
integer, private, parameter :: nia=9
contains
subroutine foo()
integer :: ierror,iatime(nia),isecnds
external pfxlocaltime
isecnds = 1
iatime = 0
call pfxlocaltime(isecnds,iatime,ierror)
print*,iatime
end subroutine foo
end module file_time_mod

program xpfx
use file_time_mod, only: foo
implicit none
integer, parameter :: nia = 9
integer :: i,isecnds,iatime(nia),ierror
isecnds = 1
iatime = 0
call pxflocaltime(isecnds,iatime,ierror)
print*,iatime
call foo()
end program xpfx

I get the error message

Intel Fortran Compiler for 32-bit applications, Version 9.1 Build 20060706Z Package ID: W_FC_C_9.1.028
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.

Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

-out:xtemp.exe
-subsystem:console
xtemp.obj
xtemp.obj : error LNK2019: unresolved external symbol _PFXLOCALTIME referenced in function _FILE_TIME_MOD_mp_FOO
xtemp.exe : fatal error LNK1120: 1 unresolved externals

If I remove the module and the call to foo(), the program compiles and runs without error. I don't see why the call to pfxlocaltime should work from the main program but not from the module.

Vivek Rao

0 Kudos
2 Replies
Steven_L_Intel1
Employee
491 Views
If you stare at the two calls long enough, it will come to you. Perhaps a careful examination of the error message will also help.
0 Kudos
vivekrao4
Beginner
491 Views

I did look at the two calls before posting, but this time I finally see that I transposed letters. Sorry about that, Steve.

0 Kudos
Reply