簡體   English   中英

使用 VS2015 在 Windows 10 上構建 Fortran .lib x64 位並將其鏈接到 C++

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

我正在使用 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 上的相同。以下是我在 Windows 10 上使用 VS2015 對 x64 系統所做的或嘗試的更改。 歡迎任何建議。 謝謝!

  1. XXX_main 項目屬性 -> 鏈接器 -> 輸入 -> 附加依賴項和庫:與之前相同
  2. XXX_main 項目屬性 -> C++ -> 包含文件夾:與之前相同
  3. XXX_main 項目屬性 -> 鏈接器 -> 高級 -> 目標計算機:將 MachineX84 更改為 MachineX64
  4. 配置管理器 -> 平台:x64
  5. 選項 -> 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
  7. 卸載和重新安裝 Fortran 編譯器,當前版本為: Intel(R) Visual Fortran Intel(R) 64 Compiler for Applications running on Intel(R) 64, version 19.0.5
  8. 卸載重裝Visual Studio 2015,當前版本為14.0.25431.01
    更新 3
  9. Fortran XXX 項目屬性 -> 庫 -> 輸出:x64\\Debug\\XXX.lib

我找到了解決方案。 這是我所做的:

  1. 卸載 Intel Fortran Compiler(重啟 PC)並重新安裝(重啟 PC)
  2. 右鍵單擊 Fortran 項目 XXX -> 屬性 -> Fortran -> 外部過程 -> 調用約定:將其更改為 CVF (/iface:cvf)。
  3. 右鍵C++項目XXX_main -> Properties -> VC++ Folders -> Library folders:添加Fortran編譯器路徑$(IFORT_COMPILER19)\\compiler\\lib\\intel64

無論如何感謝您的幫助。 此致

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM