小编use*_*052的帖子

Fortran编译错误 - 未定义的引用

我正在尝试编译一个使用一堆模块的fortran程序.编译时我得到一个错误,这让我发疯了.该错误是由添加一个子例程引起的,当我尝试重新编译程序时发生:

主程序包含以下两行:

-

call read_step(nStepOne,molOne)
call read_step(nStep,mol)
Run Code Online (Sandbox Code Playgroud)

-

这是调用文件"fileio.f90"子程序中的一种:

-

subroutine read_step(n,tape)

implicit none

integer, intent(in) :: tape
integer, intent(out) :: n

character(len=6) :: dum

rewind(tape)
read (tape,*)
read (tape,*) dum, n
rewind(tape)
return
!
end subroutine read_step
Run Code Online (Sandbox Code Playgroud)

-

当我尝试编译它时,出现以下错误:

ifort -o SpIdMD.x *.o -static-intel -openmp 
SpIdMD.o: In function `MAIN__':
SpIdMD.f90:(.text+0x3b2): undefined reference to `read_step_'
SpIdMD.f90:(.text+0x3c5): undefined reference to `read_step_'
make: *** [SpIdMD.x] Error 1
Run Code Online (Sandbox Code Playgroud)

在同一个模块中对子程序的其他调用没有给出任何错误,我只是看不到对"旧子程序"的调用与我刚刚创建的那个之间的任何区别.

这些"旧子程序"中的一个没有任何抱怨的例子是:

在主程序中:

call get_dim(n_atom,nSnap,mol)
Run Code Online (Sandbox Code Playgroud)

在fileio.f90中:

subroutine get_dim(n,n_snap,tape)

implicit none

integer,intent(in) :: tape
integer,intent(out) :: …
Run Code Online (Sandbox Code Playgroud)

fortran

8
推荐指数
1
解决办法
3万
查看次数

如果键是字符串类型,为什么“key in myObject”不会缩小类型?

我不明白这一点:

const VALUES = {
  name: "name",
  age: "age",
  address: "address",
};

export function getVal(key: string) {
  if (key in VALUES) {
// Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ name: string; age: string; address: string; }'.
//  No index signature with a parameter of type 'string' was found on type '{ name: string; age: string; address: string; }'.ts(7053)
    return VALUES[key];
  }

  return "";
}
Run Code Online (Sandbox Code Playgroud)

条件明确地使成为true 分支中的key键之一。 …

narrowing typescript

5
推荐指数
1
解决办法
756
查看次数

标签 统计

fortran ×1

narrowing ×1

typescript ×1