简体   繁体   English

使用 VS2015 在 Windows 10 上构建 Fortran .lib x64 位并将其链接到 C++

[英]build Fortran .lib x64 bit on windows 10 using VS2015 and link it to C++

I'm building a c++ and Fortran mixed program using VS2015, which was perfectly fine on windows 7. A Fortran XXX.lib was first built and then linked to C++ XXX_main (build dependencies -> project dependencies).我正在使用 VS2015 构建一个 c++ 和 Fortran 混合程序,这在 windows 7 上非常好。首先构建了 Fortran XXX.lib,然后链接到 C++ XXX_main(构建依赖项 -> 项目依赖项)。 Now I'm trying to migrate it to windows 10 with target computer x64, but still using VS2015 and there are compiling errors that I cannot find solutions after weeks searching.现在我正在尝试使用目标计算机 x64 将其迁移到 Windows 10,但仍在使用 VS2015 并且存在编译错误,我在搜索数周后找不到解决方案。

Here is the compiling information:以下是编译信息:

------ 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 ==========

The sources files are of course the same as on windows 7. Here are the changes that I've made or tried on windows 10 using VS2015 regarding to x64 system.源文件当然与 Windows 7 上的相同。以下是我在 Windows 10 上使用 VS2015 对 x64 系统所做的或尝试的更改。 Any suggestions are welcome.欢迎任何建议。 Thanks!谢谢!

  1. XXX_main project Properties -> Linker -> Input -> additional dependencies and libraries: same as before XXX_main 项目属性 -> 链接器 -> 输入 -> 附加依赖项和库:与之前相同
  2. XXX_main project Properties -> C++ -> include folders: same as before XXX_main 项目属性 -> C++ -> 包含文件夹:与之前相同
  3. XXX_main project Properties -> Linker -> advanced -> Target computer: change MachineX84 to MachineX64 XXX_main 项目属性 -> 链接器 -> 高级 -> 目标计算机:将 MachineX84 更改为 MachineX64
  4. Configurations Manager -> Platform: x64配置管理器 -> 平台:x64
  5. Option -> Intel Compilers and tools -> C++ -> Compilers: change win32 to x64选项 -> Intel Compilers and tools -> C++ -> Compilers: 将 win32 改为 x64
  6. Option -> Intel Compilers and tools ->Visual Fortran -> Compilers -> Includes: add $(IFORT_COMPILER15)\\compiler\\include -> Libraries: add $(IFORT_COMPILER15)\\compiler\\lib\\intel64 Option -> Intel Compilers and tools ->Visual Fortran -> Compilers -> Includes: add $(IFORT_COMPILER15)\\compiler\\include -> Libraries: add $(IFORT_COMPILER15)\\compiler\\lib\\intel64
  7. Deinstallation and new installation of Fortran compilers, the current version is: Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, version 19.0.5卸载和重新安装 Fortran 编译器,当前版本为: Intel(R) Visual Fortran Intel(R) 64 Compiler for Applications running on Intel(R) 64, version 19.0.5
  8. Deinstallation and new installation of Visual Studio 2015, the current version is 14.0.25431.01卸载重装Visual Studio 2015,当前版本为14.0.25431.01
    Update 3更新 3
  9. Fortran XXX project Properties -> Libraries -> out: x64\\Debug\\XXX.lib Fortran XXX 项目属性 -> 库 -> 输出:x64\\Debug\\XXX.lib

I've found the solution.我找到了解决方案。 Here is what I did:这是我所做的:

  1. Deinstall Intel Fortran Compiler (restart PC) and install it again (restart PC)卸载 Intel Fortran Compiler(重启 PC)并重新安装(重启 PC)
  2. Right click on Fortran project XXX -> Properties -> Fortran -> External Procedures -> Calling Convention: change it to CVF (/iface:cvf).右键单击 Fortran 项目 XXX -> 属性 -> Fortran -> 外部过程 -> 调用约定:将其更改为 CVF (/iface:cvf)。
  3. Right click on C++ project XXX_main -> Properties -> VC++ Folders -> Library folders: add the Fortran compiler path $(IFORT_COMPILER19)\\compiler\\lib\\intel64右键C++项目XXX_main -> Properties -> VC++ Folders -> Library folders:添加Fortran编译器路径$(IFORT_COMPILER19)\\compiler\\lib\\intel64

Thanks for the help anyhow.无论如何感谢您的帮助。 Best Regards此致

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OpenCV:在VS2015 x64版本的Windows 10上将Qt库与cvFontQt和cvAddText一起使用时,不会显示文本 - OpenCV: Text does not display when using the Qt library with cvFontQt and cvAddText on Windows 10 in VS2015 x64 build 如何在Windows 10上使用Visual Studio 2015 x64配置和构建Tesseract OCR C ++ - How to configure and build Tesseract OCR C++ using Visual Studio 2015 x64 on Windows 10 在Windows 10 VS2015上构建Boost-无法打开* .lib - Build Boost on Windows 10 VS2015 - Cannot Open *.lib 如何在Windows 10 x64上使用Bazel构建和调试C ++可执行文件 - How to build and debug a c++ executable using Bazel on windows 10 x64 VS2015 x64的三角形库 - Triangle library with VS2015 x64 编辑并继续在VS2015 Update 3(x64)中不起作用 - Edit & continue not working in VS2015 Update 3 (x64) C ++:Windows 10 x64和Windows 7 x64上的MFC应用程序 - C++: MFC Application on both Windows 10 x64 & Windows 7 x64 如何在Windows x64机器上使用VS 2010构建MySQL连接器c ++? - How to build MySQL connector c++ with VS 2010 on a Windows x64 machine? 如何在 VS2015 中的 windows 10 上构建 snappy? - How to build snappy on windows 10 in VS2015? 用于Windows 10(x64)的tesseract.lib(版本4) - tesseract.lib (version 4 ) for windows 10 (x64)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM