编译时无法解析的外部符号“ for_realloc_lhs”

时间:2019-04-04 13:24:29

标签: c visual-studio fortran linker-errors

我正在尝试使用预先构建的Fortran库编译SDK。 该SDK需要Intel Fortran可再发行文件库XE 2017并行工作室。 尝试编译SDK的示例文件时,出现多个错误: LNK2001“未解决的外部symol _for_realloc_lhs”

据我所知,这可能是由于SDK的fortran库使用过旧的Intel fortran编译器版本进行编译所致。 (see here),但是我不拥有SDK的fortran源,因此无法重新编译它们。

我想知道我是否在这里缺少东西,或者是否暗示该SDK的fortran库是使用错误的工具构建的。

[编辑] 我读了您说的内容(感谢您的明确解释),看来我的问题确实接近您刚才的解释,我似乎与11.1版的Intel可再发行组件有关。但是,看来我在英特尔网站上获得的库没有包含链接程序正在查找的所有文件。 (或者至少我找不到它们)。 有使用Visual Studio的命令。 不幸的是,由于超出了最大邮件大小,我目前无法生成日志。

/OUT:"D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\SDK_Matisse\Debug\Tutorials.exe" /MANIFEST /NXCOMPAT /PDB:"D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\SDK_Matisse\Debug\Tutorials.pdb" /DYNAMICBASE "CK_IO.lib" "matisse3.0_c_lib.lib" "matisse3.0_f_lib.lib" "SDK_Matisse.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" "legacy_stdio_definitions.lib" "D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\lib\SDK_Matisse.lib" /MACHINE:X86 /INCREMENTAL /PGD:"D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\SDK_Matisse\Debug\Tutorials.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\Tutorials.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /VERBOSE /LIBPATH:"..\..\lib" /LIBPATH:"Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\compiler\lib\ia32_win" /LIBPATH:"H:\MATISSE\SDK\SDK_Delivery_Win32\lib" /TLBID:1 

这是日志的摘要版本

1>------ Build started: Project: Tutorials, Configuration: Debug Win32 ------
1>
1>  Searching libraries
1>      Searching ..\..\lib\CK_IO.lib:
1>      Searching ..\..\lib\matisse3.0_c_lib.lib:
1>      Searching ..\..\lib\matisse3.0_f_lib.lib:
1>      Searching ..\..\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\winspool.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbc32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbccp32.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_definitions.lib:
1>      Searching D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\LIBCMT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libvcruntime.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10150.0\ucrt\x86\libucrt.lib:
1>      Searching ..\..\lib\CK_IO.lib:
1>      Searching ..\..\lib\matisse3.0_c_lib.lib:
1>      Searching ..\..\lib\matisse3.0_f_lib.lib:
1>      Searching ..\..\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\winspool.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbc32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbccp32.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_definitions.lib:
1>      Searching D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\LIBCMT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libvcruntime.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10150.0\ucrt\x86\libucrt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\ifconsol.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libifcoremt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libmmt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libirc.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\svml_dispmt.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ImageHlp.lib:
1>      Searching ..\..\lib\CK_IO.lib:
1>      Searching ..\..\lib\matisse3.0_c_lib.lib:
1>      Searching ..\..\lib\matisse3.0_f_lib.lib:
1>      Searching ..\..\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\winspool.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbc32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbccp32.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_definitions.lib:
1>      Searching D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\LIBCMT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libvcruntime.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10150.0\ucrt\x86\libucrt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\ifconsol.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libifcoremt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libmmt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libirc.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\svml_dispmt.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ImageHlp.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_wide_specifiers.lib:
1>      Searching ..\..\lib\CK_IO.lib:
1>      Searching ..\..\lib\matisse3.0_c_lib.lib:
1>      Searching ..\..\lib\matisse3.0_f_lib.lib:
1>      Searching ..\..\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\winspool.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbc32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbccp32.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_definitions.lib:
1>      Searching D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\LIBCMT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libvcruntime.lib:
1>
1>  Finished searching libraries
1>
1>  Searching libraries
1>      Searching ..\..\lib\CK_IO.lib:
1>      Searching ..\..\lib\matisse3.0_c_lib.lib:
1>      Searching ..\..\lib\matisse3.0_f_lib.lib:
1>      Searching ..\..\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\winspool.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\oleaut32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbc32.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\odbccp32.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_definitions.lib:
1>      Searching D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\lib\SDK_Matisse.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\LIBCMT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\OLDNAMES.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libvcruntime.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\10\lib\10.0.10150.0\ucrt\x86\libucrt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\ifconsol.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libifcoremt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libmmt.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\libirc.lib:
1>      Searching C:\Program Files (x86)\Common Files\Intel\Shared Files\fortran\Lib\ia32\svml_dispmt.lib:
1>      Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ImageHlp.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\legacy_stdio_wide_specifiers.lib:
1>
1>  Finished searching libraries
1>matisse3.0_f_lib.lib(tau_L_col_m.obj) : error LNK2019: unresolved external symbol _for_realloc_lhs referenced in function _tau_l_col_mp_rprsnec_
1>matisse3.0_f_lib.lib(MNT_L_nuages_m.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>matisse3.0_f_lib.lib(MNT_C_param_opt_m.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>matisse3.0_f_lib.lib(MNT_L_aerosols_m.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>matisse3.0_f_lib.lib(NUA_C_Bdd.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>matisse3.0_f_lib.lib(ZEV_C_aero_strato.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>matisse3.0_f_lib.lib(AERO_Angstrom.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>matisse3.0_f_lib.lib(MNT_C_Calc_Sol.obj) : error LNK2001: unresolved external symbol _for_realloc_lhs
1>D:\slendorm\DDMNG\Outils\MATISSE\MATISSE_WINDOWS\SDK\SDK_Delivery_Win32\SDK_Matisse\Debug\Tutorials.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

我还想提到应该在其中安装可再发行文件的目录(如here:“ redist [ia32 | intel64] \ mpirt(对于Fortran软件包)”)没有库名为libifcore ... 实际上,几乎没有什么看起来像我需要链接的东西。)an image of the mentionned folder

1 个答案:

答案 0 :(得分:1)

首先,一个尼特。该错误来自链接步骤,而不是编译。与您对该库使用的编译器版本“太旧”的猜测相反,它是您要针对的链接的英特尔库(可再发行产品)的集合,它们太旧(或丢失了?)如果您真正针对2017年进行了链接-version库,该例程应在libifcore中。仔细检查链接的方式,以及在链接步骤中命名的库(如果有的话)。

查看正在发生的事情的一种简单方法是将链接器选项/ verbose添加到链接步骤。您尚未显示如何构建应用程序以及用于链接的命令。如果您使用的是Visual Studio,请将项目属性Linker > General > Show Progress设置为“显示所有进度消息”。如果使用ifort命令,请在末尾/link /verbose处添加。如果使用其他命令,请查看其文档以了解应如何指定链接选项。捕获链接器输出(构建日志或其他内容)-它将命名它搜索的每个库以及哪些符号来自何处。

这很简单,只需在链接步骤中确保将SDK库命名为Intel库即可。

如果这没有帮助,请编辑问题以添加用于链接的命令(编译无关紧要)并显示实际输出(不汇总)。