编译和链接到外部目录compq fortran命令提示符中的已使用模块 [英] Compiling and Linking to used modules in external directory compaq fortran command prompt

查看:278
本文介绍了编译和链接到外部目录compq fortran命令提示符中的已使用模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这里提出了类似的问题:

I've already asked a similar question, here:

链接到外部目录中的模块Compaq Visual Fortran命令提示符

我想第一个答案是正确的(也就是说,在手册中他们说你可以简单地在模块之前指定路径名),但在删除我的库文件夹中的临时文件之后,这种方法似乎停止了工作。尝试使用/ include [:path]方法,这是我的.bat文件:

And I thought that the first answer was correct (that is, in the manual they say you can simply specify the path name before the module), but after deleting the temporary files in my library folder, this approach seemed to stop working. Trying with the /include[:path] approach, here is my .bat file:

 df /include:..\FORTRAN_LIB\ __constants 
 myIO griddata_mod myfdgen myDiff magneticField /exe:magneticField

错误是回复说:

 __constants
 myIO
 griddata_mod
 myfdgen
 myDiff
 magneticField
 f90: Severe: No such file or directory
 ... file is '__constants'

再次,我很抱歉这个问题非常具体,但似乎它应该很简单,根本不起作用。

Again, I apologize that this question is VERY specific, but it seems like it should be simple and does not work at all.

ps最初,我使用的是:

p.s. Originally, I was using:

 df ..\FORTRAN_LIB\__constants ..\FORTRAN_LIB\myIO 
 ..\FORTRAN_LIB\griddata_mod ..\FORTRAN_LIB\myfdgen 
 ..\FORTRAN_LIB\myDiff magneticField /exe:magneticField

但是,正如我所说,我删除了FORTRAN_LIB文件夹中的临时文件后,它停止了工作。 另请注意,这些.bat文件只使用了一行,为了便于阅读,我将它们分成几行。我更喜欢使用/ include [:path]选项,因为这似乎是一个更好的解决方案。

But, as I've said, it stopped working after I deleted the temporary files in my FORTRAN_LIB folder. Also note, these .bat files used only one line, I've broken them into several lines just for readability. I would prefer using the /include[:path] option since that seems like a better solution.

非常感谢任何帮助!

推荐答案

好的,我想我至少找到了一个解决方法。我知道/ include [:dir]指定在dir中搜索包含的文件。但是从文档中可以看出,这也指定了搜索USEd模块,但似乎并非如此。

Okay, so I think I figured out a workaround at the very least. I understood that the /include[:dir] specifies to search in "dir" for included files. But it seemed from documentation, that this also specifies to search for USEd modules but that doesn't seem to be the case.

我的程序现在看起来像这样:

My program now looks like this:

   include '..\FORTRAN_LIB\__constants.f90'
   include '..\FORTRAN_LIB\computeError.f90'
   include '..\FORTRAN_LIB\griddata_mod.f90'
   include '..\FORTRAN_LIB\myfdgen.f90'
   include '..\FORTRAN_LIB\myDiff.f90'
   include '..\FORTRAN_LIB\myIO.f90'

   program magneticField
   use constants
   use computeError_mod
   use griddata_mod
   use myfdgen_mod
   use myDiff_mod
   use myIO_mod
   implicit none
   ...

我的DF命令如下:

   df magneticField /exe:magneticField

一切似乎工作正常。使用/ include [:dir]选项会更好,但是我能够在一个单独的目录中访问,我很满意。如果有人能找到更好的解决方案,我会切换复选标记。我希望这对像我这样困惑的其他人有所帮助。

And everything seems to work fine. It would be nicer to have the /include[:dir] option, but so long I'm able to reach in a separate directory, I'm satisfied. If anyone can find a better solution I'll switch the checkmark. I hope this helps with anyone else who was confused like me.

这篇关于编译和链接到外部目录compq fortran命令提示符中的已使用模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆