【发布时间】:2020-05-25 14:15:07
【问题描述】:
我正在使用 VS2015 构建一个 c++ 和 Fortran 混合程序,这在 Windows 7 上非常好。首先构建了一个 Fortran XXX.lib,然后链接到 C++ XXX_main(构建依赖项 -> 项目依赖项)。现在我正在尝试将其迁移到目标计算机 x64 的 windows 10,但仍在使用 VS2015 并且存在编译错误,经过数周搜索后我无法找到解决方案。
编译信息如下:
------ Neues Erstellen gestartet: Projekt: XXX, Konfiguration: Debug x64 ------
1>Deleting intermediate files and output files for project 'XXX', configuration 'Debug|x64'.
1>Compiling with Intel(R) Visual Fortran Compiler 19.0.5.281 [Intel(R) 64]...
1>scout2d.f
1>E:\test\src\scout2d.f(74): error #8110: The module file for compiler-generated interface was generated for a different platform or by an incompatible compiler or compiler release. It cannot be read. Use -gen-interfaces option. [XGET__GENMOD]
1>fortcom: Fatal: There has been an internal compiler error (C0000005).
1>compilation aborted for E:\test\src\scout2d.f (code 1)
...........
1>scp_lib - 82 error(s), 18 warning(s)
1>XXX - 82 error(s), 18 warning(s)
2>------ Neues Erstellen gestartet: Projekt: XXX_main, Konfiguration: Debug x64 ------
...........
2> XXX_main.vcxproj -> E:\test\x64\Debug\XXX_main.exe
2> XXX_main.vcxproj -> E:\test\x64\Debug\/XXX_main.pdb (Full PDB)
========== Alles neu erstellen: 1 erfolgreich, 1 fehlerhaft, 0 übersprungen ==========
源文件当然与 Windows 7 上的相同。以下是我使用 VS2015 在 Windows 10 上针对 x64 系统所做或尝试的更改。欢迎任何建议。谢谢!
- XXX_main 项目属性 -> 链接器 -> 输入 -> 附加依赖项和库:与之前相同
- XXX_main 项目属性 -> C++ -> 包含文件夹:和之前一样
- XXX_main 项目属性 -> 链接器 -> 高级 -> 目标计算机:将 MachineX84 更改为 MachineX64
- 配置管理器 -> 平台:x64
- 选项 -> 英特尔编译器和工具 -> C++ -> 编译器:将 win32 更改为 x64
- 选项 -> 英特尔编译器和工具 ->Visual Fortran -> 编译器 -> 包括:添加 $(IFORT_COMPILER15)\compiler\include -> 库:添加 $(IFORT_COMPILER15)\compiler\lib\intel64
- Fortran编译器的卸载和新安装,当前版本为: 英特尔(R) Visual Fortran 英特尔(R) 64 编译器,适用于在英特尔(R) 64 版本 19.0.5 上运行的应用程序
- 卸载新安装Visual Studio 2015,当前版本为14.0.25431.01
更新 3 - Fortran XXX 项目属性 -> 库 -> 输出:x64\Debug\XXX.lib
【问题讨论】:
-
错误消息说明了该怎么做:“编译器生成接口的模块文件是为不同的平台或由不兼容的编译器或编译器版本生成的。无法读取。使用 -gen-interfaces选项”:你这样做了吗?
-
嗨,Richard,平台是 x64,编译器也适用于 x64。你能解释一下我还应该检查什么吗?恐怕我可能没有清楚地理解这条信息。
-
您是否按照问题中错误消息文本中的说明重新生成模块文件(我在之前的评论中引用过)?
-
如果您指的是 \x64\Debug\ 或 \x64\Release\ 下的 *.mod 文件,它们都是新的。我已经删除了所有旧的 *.mod 文件,包括 scout2d.mod。还是您通过重新生成模块文件来表示其他意思?
-
请阅读编译器给你的错误信息:说你需要用新的配置重建模块文件,以及使用什么命令行选项。
标签: c++ windows visual-studio fortran 64-bit