Update
感谢弗拉基米尔对图书馆的有用见解。我采取了另一种方法,首先在 ubuntu 中开发(这比使用 Eclipse/Cygwin/... 容易得多,现在我尝试移植到 Windows,这相当不错,但是我对此也有一些疑问,发布在这里:将 fortran 程序从 ubuntu 移植到 windows 时出现问题 https://stackoverflow.com/questions/17869288/problems-with-porting-a-fortran-program-from-ubuntu-to-windows
Question
我目前有以下设置,但无法配置 lapack 库以便我的 Fortran 代码可以编译:
- Windows 7的
- Cygwin 安装(适用于 GNU fortran),添加到 windows PATH
- lapack and liblapack-devel installed with cygwin
- 导致文件夹 C:/cygwin/lib 中生成 liblapack.a 和 libblas.a
在我的程序中,我使用以下代码调用 lapack 库
program myProgram
!use lapack (stays commented now)
...
在 Eclipse 中,我使用了以下设置(使用 Photran 包):
- Fortran 项目:Windows 上可执行的 GNU fortran(GCC 工具链)
- GNU fortran 编译器:
gfortran ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
- GNU Fortran 链接器:
gfortran ${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
我编译了 libblas.a 和 liblapack.a 库,用作 Windows 的静态库,它们位于 C:/cygwin/lib 文件夹中。在 GNU fortran 链接器属性中,这些库被称为lapack
and blas
在文件夹中C:/cygwin/lib
。这导致了一部分-L"C:/cygwin/lib" -llapack -lblas
in the {$COMMAND}
编译器和链接器部分。 (感谢@vladimir-f 的帮助)
输出中不再有错误消息。只是我现在在 Eclipse 中遇到以下错误,并且没有最终的 .exe 或 bin:
Errors occured during the build.
Errors running builder 'CDT Builder' on project 'Hamfem'
Internal error building project Hamfem configuration
Release
java.lang.NullPointerException
Internal error building project Hamfem configuration
Release
java.lang.NullPointerException
但是,构建的结果仍然是可执行文件,在本例中称为 Hamfem.exe。运行此文件会产生错误消息(而不是例程):The program can't start because cyglapack-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
该文件当前位于C:/cygwin/lib/lapack/
但我希望运行该程序不需要该文件,因此我可以在不同的计算机上运行它。有人可以合作吗?
其次,当将 .dll 文件复制粘贴到 .exe 所在的文件夹中时,它会运行一小会儿,生成一个 stackdump 文件。由于“构建工作空间”错误,我无法在 Eclipse-Photran 中使用调试器。 Eclipse 给出了消息Binary not found
当我想在 Eclipse 中将其作为本地 Fortran 程序运行时。有什么想法如何解决这个问题吗?