0

我正在尝试构建一个主要是 C 但有一些 Fortran 子例程的项目。代码很旧,我正试图让它在现代机器上运行。我的主函数调用了一个外部函数

extern void __stdcall mainlhs(void);

该函数是一个用 Fortan 编写的子程序

subroutine mainlhs

我想使用 f2c 转换 Fortran 代码(包含这个和其他子例程)并将结果放入我的项目中。

f2c 确实转换了代码,并且生成的 C 代码确实可以编译。当我尝试构建项目时,有几个链接错误。

Error   35  error LNK2019: unresolved external symbol _e_wsle referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   36  error LNK2019: unresolved external symbol _s_wsle referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   37  error LNK2019: unresolved external symbol _f_clos referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   38  error LNK2019: unresolved external symbol _e_rsle referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   39  error LNK2019: unresolved external symbol _do_lio referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   40  error LNK2019: unresolved external symbol _s_rsle referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   41  error LNK2019: unresolved external symbol _f_open referenced in function _mainlhs_  C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   42  error LNK2019: unresolved external symbol _s_stop referenced in function _chlsky_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   43  error LNK2019: unresolved external symbol _e_wsfe referenced in function _gaminv_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   44  error LNK2019: unresolved external symbol _do_fio referenced in function _gaminv_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   45  error LNK2019: unresolved external symbol _s_wsfe referenced in function _gaminv_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   46  error LNK2019: unresolved external symbol _pow_dd referenced in function _gamcdf_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   47  error LNK2019: unresolved external symbol _pow_ri referenced in function _moment_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj
Error   48  error LNK2019: unresolved external symbol _s_paus referenced in function _betpdf_   C:\Users\giazlas\Documents\Socrates Support\projects\lhsforc\lhsforc\UNCER.obj

这些函数不会出现在原始 Fortran 代码中,也不会出现在其他任何地方。我只在 netlib 的 f2c 源中找到了它们的引用

谢谢你的帮助

4

1 回答 1

2

我认为您还需要链接 libf2c 中的函数,该函数可从 Netlib 获得,如http://www.netlib.org/f2c/README中所述。

于 2014-05-13T20:16:30.357 回答