gpt4 book ai didi

fortran - 编译 nr.f90 时出错

转载 作者:行者123 更新时间:2023-12-04 04:37:41 24 4
gpt4 key购买 nike

我需要在我的 Fortran 90 代码中使用 MRQMIN 子例程。在这个子程序里面还有一些其他的模块nrtype.90 , nrutil.f90nr.f90 .我正在使用这些命令编译所有这些模块和我自己的代码

ifort -c nrtype.90  
ifort -c nrutil.f90
ifort -c nr.f90
ifort test.f90 nrtype.o nrutil.o nr.o -o test

但我收到此错误
/tmp/ifortcx4Tb3.o: In function `mrqmin_IP_mrqmin_private_':  
test.f90:(.text+0x4041): undefined reference to `gaussj_'
test.f90:(.text+0x4896): undefined reference to `covsrt_'
test.f90:(.text+0x48a5): undefined reference to `covsrt_'

我在编译过程中遗漏了一些东西吗?

最佳答案

nr.f90只提供子程序的接口(interface),而不是子程序本身。

你必须编译gaussj.f90covsrt.f90单独并指定它们(我试过 gfortran 但它也应该与 ifort 一起使用):

gfortran -c gaussj.f90
gfortran -c covsrt.f90
gfortran test.f90 mrqmin.o nr.o nrtype.o nrutil.o gaussj.o covsrt.o

关于fortran - 编译 nr.f90 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19446217/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com