gfortran编译器无法找到拼写错误的完整目录 [英] gfortran compiler cannot find misspelled full directory
问题描述
我能够做出比我原来的帖子更简单的例子。我试图在Windows上使用 gcc版本4.9.2(x86_64-posix-seh-rev4,由MinGW-W64项目构建)
编译Fortran代码。
以下是我用来成功编译代码的批处理脚本:
SET SRC_DIR = code
gfortran -fopenmp -g -fimplicit-none -cpp ^
%SRC_DIR%/ globals / current_precision.f90 ^
%SRC_DIR%/ string /string.f90^
...
%SRC_DIR%/ user / MOONS.f90 ^
parametricStudy.f90 ^
-o main.exe
del *。 mod
输出如下所示:
C:\Users\charl\Documents\GitHub\Monsons> gfortran -fopenmp -g -fimplicit-none -cpp
code / globals / current_precision.f90
code / string / string.f90
...
code / user / MOONS.f90
parametricStudy.f90 -o main.exe
C :\ Users \charl\Documents\GitHub\MONONS> del * .mod
然后我试着通过改变来改变从本地到完整的源代码路径:
SET SRC_DIR = code
至
SET SRC_DIR = C:/ Users / charl / Documents / GitHub / MOONS / code
但现在输出:
C:\Users\charl\Documents\GitHub\Monsons> gfortran -fopenmp -g -fimplicit-none -cpp
C:/Users/charl/Documents/GitHub/MOONS/code/globals/current_precision.f90
...
C:/ Users / charl / Documents / GitHub / MOONS / code / solvers / induction / init_Bfield.f90
C:/ Users / charl / Documents / GitHub
gfortran:错误:
C:/ Users / GitHubMOONS / code / solvers / induction / init_Sigma.f90:没有这样的文件或目录
em> not 使用变量并且发生了相同的事情,所以这似乎与完整路径有关而不是变量的使用。我有两个问题:
$ b $ 1)使用完整路径导致错误的原因是什么?
2)为什么在全路径中出现拼写错误? (GitHubMOONS应为GitHub / MOONS)
我的解决方案是使用相对路径为源文件。这样做编译没有错误。如果这种情况在未来发生变化,那么我会更新这篇文章。
总之,只需使用
SET SRC_DIR = code
I was able to make a much simpler example than the one in my original post. I'm trying to compile a fortran code using gcc version 4.9.2 (x86_64-posix-seh-rev4, Built by MinGW-W64 project)
on windows.
Below is a batch script that I used to successfully compile the code:
SET SRC_DIR=code
gfortran -fopenmp -g -fimplicit-none -cpp ^
%SRC_DIR%/globals/current_precision.f90^
%SRC_DIR%/string/string.f90^
...
%SRC_DIR%/user/MOONS.f90^
parametricStudy.f90^
-o main.exe
del *.mod
The output looks like this:
C:\Users\charl\Documents\GitHub\MOONS>gfortran -fopenmp -g -fimplicit-none -cpp
code/globals/current_precision.f90
code/string/string.f90
...
code/user/MOONS.f90
parametricStudy.f90 -o main.exe
C:\Users\charl\Documents\GitHub\MOONS>del *.mod
Then I tried changing the source path from local to full by changing:
SET SRC_DIR=code
to
SET SRC_DIR=C:/Users/charl/Documents/GitHub/MOONS/code
But the output is now:
C:\Users\charl\Documents\GitHub\MOONS>gfortran -fopenmp -g -fimplicit-none -cpp
C:/Users/charl/Documents/GitHub/MOONS/code/globals/current_precision.f90
...
C:/Users/charl/Documents/GitHub/MOONS/code/solvers/induction/init_Bfield.f90
C:/Users/charl/Documents/GitHub
gfortran: error:
C:/Users/charl/Documents/GitHubMOONS/code/solvers/induction/init_Sigma.f90: No such file or directory
I also tried not using variables and the same thing happened, so this seems to be related to the full path and not the use of variables. I have two questions
1) What is the reason for the error due to using the full path?
2) Why is there a misspelling in the full path? ("GitHubMOONS" should read "GitHub/MOONS")
My solution is to use relative paths for the source files. Doing so compiles fine without errors. If this somehow changes in the future, then I will update this post.
In short, just use
SET SRC_DIR = code
这篇关于gfortran编译器无法找到拼写错误的完整目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!