LiyuanHu91的个人博客分享 http://blog.sciencenet.cn/u/LiyuanHu91

博文

Fortran学习(3):初试Visual Studio中的Fortran编程

已有 6871 次阅读 2021-8-10 11:11 |个人分类:计算机使用|系统分类:科研笔记

过去编写Fortran程序基本上都是在Linux下进行,近期由于需要也开始在Windows下编写。这里只整理一下准备工作。

(1)首先是在Windows10操作系统下搭建Visual Studio 2019+Base+HPC平台,其采用Intel Fortran编译器。完全免费!

这些软件的下载地址如下:

Visual Studio 2019 Community Version

https://link.zhihu.com/?target=https%3A//visualstudio.microsoft.com/zh-hans/downloads/)

Intel oneAPI Base Toolkit 2021

https://link.zhihu.com/?target=https%3A//software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html%3Foperatingsystem%3Dwindow%26distributions%3Dwebdownload%26options%3Doffline)

Intel oneAPI HPC Toolkit 2021

https://link.zhihu.com/?target=https%3A//software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit/download.html%3Foperatingsystem%3Dwindow%26distributions%3Dwebdownload%26options%3Doffline)

(2)为方便程序的用户能够方便地使用程序,希望能够生成exe可执行程序。

(a)选择Release,x86或x64

image.png

(b)生成->生成解决方案,在Release文件夹中得到exe文件。

然而当双击exe文件时,出现报错:“由于找不到libifcoremd.dll,无法继续执行代码”。以为仅是需要安装一个libifcoremd.dll即可,结果发现不行!首先是没有找到能安装上的libifcoremd.dll文件;其次是当尝试将该文件放到与exe文件同一文件夹里,结果出来另一种不可执行的错误;最后是,采用Dependency Walker分析该exe文件的依赖DLL,发现有许多文件缺失(约莫有20来个?),一一补上也很不现实。终于,还是在参考资料4中找到了解决方案,安装了参考资料5中的“Redistributable Libraries for Intel® Fortran 2018 Compilers for Windows”,更确切地说安装了其中的“Update 4:Redistributable library package”。内含两个文件,一个32位,一个64位,一路确认安装。很快安装好后,双击exe文件,结果符合预期!

(3)将exe文件拿到其他电脑上测试

将该exe文件放到媳妇的老三星笔记本进行测试,该机器是Windows7系统。在未安装Redistributable Libraries for Intel® Fortran 2018 Compilers for Windows前,双击exe文件,一样报错:“由于找不到libifcoremd.dll,无法继续执行代码”。安装Redistributable Libraries for Intel® Fortran 2018 Compilers for Windows后,双击exe文件,执行成功!这意味着如果我们只提供exe程序而不提供源码给用户,那么我们也需要提供给用户Redistributable Libraries for Intel® Fortran 2018 Compilers for Windows。


参考资料

1. 【包学包会】【Fortran篇】VisualStudio免费配置Fortran,再也不用激活啦!

https://zhuanlan.zhihu.com/p/381304054

2. 2021年如何配置免费的Fortran编译环境(Visual Studio IDE)

https://zhuanlan.zhihu.com/p/381304054

3. vs2019如何生产exe

https://blog.csdn.net/wurongchuyu/article/details/105479606

4. Executable not runnig on other computers without compiler or visual studio

http://feap.berkeley.edu/forum/index.php?topic=1947.0

5. Redistributable Libraries for Intel® C++ and Fortran 2018 Compilers for Windows

https://software.intel.com/content/www/us/en/develop/articles/redistributable-libraries-for-intel-c-and-fortran-2018-compilers-for-windows.html



https://wap.sciencenet.cn/blog-3121583-1299118.html

上一篇:LaTeX学习笔记(5)
下一篇:Office学习(1):两个Excel文件去重
收藏 IP: 221.212.116.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-7 21:29

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部