- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did look at the two calls before posting, but this time I finally see that I transposed letters. Sorry about that, Steve.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page