Fortran 编译器突然找不到“deallocate” [关闭]

Fortran compiler suddenly cannot find "deallocate" [closed]

提问人:bob.sacamento 提问时间:8/24/2023 更新时间:8/24/2023 访问量:101

问:


编辑问题以包括所需的行为、特定问题或错误以及重现问题所需的最短代码。这将帮助其他人回答这个问题。

3个月前关闭。

我正在开发一个 Fortran 代码,在一天中的大部分时间里,编译、链接和执行都没有问题。突然,当我尝试编译时,在链接阶段,编译器告诉我它找不到“deallocate_”。具体说来

undefined reference to `deallocate_'

这怎么可能?顺便说一句,它发现“分配”没有问题。知道出了什么问题吗?我在 Red Hat 机器上使用 Intel 19.0。mpiifort

Fortran intel-fortran

评论

0赞 Gene 8/24/2023
至于“这怎么可能?”,也许它一直缺失,但今天你写了第一个需要它的代码。
3赞 steve 8/24/2023
没有看到代码,我们只能猜测。我的猜测是你做错了什么。

答:

3赞 Ian Bush 8/24/2023 #1

像往常一样,没有代码,一切都是猜测,但这里有一种方法:

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$