Compiling and Linking to used modules in external directory compaq fortran command prompt

谁说我不能喝 提交于 2019-12-25 08:54:29

问题


I've already asked a similar question, here:

Linking to modules in external directory Compaq Visual Fortran command prompt

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

And an error is returned saying:

 __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.

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

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.


回答1:


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

And my DF command like this:

   df magneticField /exe:magneticField

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.



来源:https://stackoverflow.com/questions/23642360/compiling-and-linking-to-used-modules-in-external-directory-compaq-fortran-comma

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!