Fortran:解释 "Undefined symbols for architecture x86_64"

Fortran: Interpreting "Undefined symbols for architecture x86_64"

编译程序时,出现以下错误信息:

Undefined symbols for architecture x86_64:
  "_jrand_", referenced from:
      ___trfind_module_MOD_trfind in ccqRBw2L.o
     (maybe you meant: ___jrand_module_MOD_jrand)
  "_left_", referenced from:
      ___trmesh_module_MOD_trmesh in ccq56SyA.o
     (maybe you meant: ___left_module_MOD_left)
  "_lstptr_", referenced from:
      ___intadd_module_MOD_intadd in ccr7Tz7x.o
      ___swap_module_MOD_swap in cclq1Td3.o
      ___trfind_module_MOD_trfind in ccqRBw2L.o
      ___addnod_module_MOD_addnod in ccwGNCEK.o
     (maybe you meant: ___lstptr_module_MOD_lstptr)
  "_store_", referenced from:
      ___trfind_module_MOD_trfind in ccqRBw2L.o
     (maybe you meant: ___store_module_MOD_store)
  "_swptst_", referenced from:
      ___addnod_module_MOD_addnod in ccwGNCEK.o
     (maybe you meant: ___swptst_module_MOD_swptst)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

据我所知,这是由于模块之间的链接不正确造成的。我的问题是如何准确解释编译器提供的信息。例如,"in ccqRBw2L.o" 是什么意思?

对你来说最重要的是建议maybe you meant

很可能您忘记了 use 相关模块。特别是

"_jrand_", referenced from:
      ___trfind_module_MOD_trfind in ccqRBw2L.o
     (maybe you meant: ___jrand_module_MOD_jrand)

链接目标文件时 ccqRBw2L.o(名称由您的构建机制控制,某些 Makefile 或类似文件)链接器没有找到任何符号 _jrand_ 这将是一个外部子程序或函数称为 jrand.

但是链接器发现有一个叫做 jrand.

的东西
     maybe you meant: ___jrand_module_MOD_jrand

但它不是外部的,它似乎位于名为 jrand 的模块中。

调用此模块中的子程序或函数时,请确保使用模块(use jrand)。