问题描述
有没有办法把gfortran(GCC)生成的.mod文件放到一个单独的输出目录中?我知道如何使用-o标志来放置目标文件或其他输出: gfortran -c test.f03 -o /path/to/output/dir/test.o
但是.mod文件通过上述调用)不受-o标志的影响,并放置在当前目录中。一些商业编译器有一个像-qmoddir这样的标志,但是我找不到类似gfortran的东西。
如果没有这样的标志,是否可以通过额外的步骤生成.mod文件来获取-o标志?
GNU 文档指出 -m
dir 或其同义词 -J
dir 指定 .mod
文件的输出目录。
Is there is a way to put .mod files, generated by gfortran (GCC), into a separate output directory? I know how to place object files or other output with the -o flag as in:
gfortran -c test.f03 -o /path/to/output/dir/test.o
But the .mod files (which are generated by the above call) are not affected by the -o flag and placed in the current directory. Some commercial compilers have a flag like -qmoddir, but I cannot find something similar for gfortran.
If there's no such flag, is it possible to generate the .mod files in an extra step to get the -o flag to work?
The GNU gfortran documentation indicates that -M
dir or its synonym -J
dir specifies the output directory for .mod
files.
这篇关于gfortran:如何控制.mod文件的输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!