我正在开发 Fortran 代码,一天中的大部分时间编译、链接和执行都没有问题。突然,当我尝试编译时,在链接阶段编译器告诉我它找不到“deallocate_”。具体来说,
undefined reference to `deallocate_'
这怎么可能?顺便说一句,它发现“分配”没有问题。知道出了什么问题吗?我在 Red Hat 机器上使用 Intel 19.0,
mpiifort
。
像往常一样,没有代码,一切都是猜测,但这是一种方法:
Program dealloc
Implicit None
Call deallocate
End Program dealloc
ijb@ijb-Latitude-5410:~/work/stack$ gfortran-12 --version
GNU Fortran (GCC) 12.2.0
Copyright © 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ijb@ijb-Latitude-5410:~/work/stack$ gfortran-12 -Wall -Wextra -fcheck=all -std=f2018 dealloc.f90
/usr/bin/ld: /tmp/ccHOaRlM.o: in function `MAIN__':
dealloc.f90:(.text+0x32): undefined reference to `deallocate_'
collect2: error: ld returned 1 exit status
ijb@ijb-Latitude-5410:~/work/stack$ ifort --version
ifort (IFORT) 2021.10.0 20230609
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
ijb@ijb-Latitude-5410:~/work/stack$ ifort -stand=f18 dealloc.f90
ld: /tmp/ifortro90Qw.o: in function `MAIN__':
dealloc.f90:(.text+0x37): undefined reference to `deallocate_'
ijb@ijb-Latitude-5410:~/work/stack$ ifx --version
ifx (IFX) 2023.2.0 20230721
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
ijb@ijb-Latitude-5410:~/work/stack$ ifx -stand=f18 dealloc.f90
ld: /tmp/ifx0734875725WUp3hq/ifx6BInXp.o: in function `MAIN__':
dealloc.f90:(.text+0x19): undefined reference to `deallocate_'
ijb@ijb-Latitude-5410:~/work/stack$