Fortran 中的 print 语句没有输出
我已经编译了一个在 fortran 90 中顺序执行(而不是并行)的程序。我正在尝试使用 print 语句调试该程序以检查我生锈的 gdb fu。我正在使用 gfortran -c -O2 -ffast-math -ggdb 编译文件。然而,这些语句都不会打印任何内容:
print *, variablename1, variablename2
write(6,*) variablename1, variablename2
write(*,*) variablename1, variablename2
编译后的程序不会打印任何内容,并且执行时就好像这些语句不存在一样。我会错过一些简单而明显的东西吗?
I have compiled a program to execute sequentially (not parallel) in fortran 90. I am trying to debug the program with print statements to check my rusty gdb
fu. I am compiling the files with gfortran -c -O2 -ffast-math -ggdb
. However, none of these statements print anything:
print *, variablename1, variablename2
write(6,*) variablename1, variablename2
write(*,*) variablename1, variablename2
The compiled program prints nothing and executes as if the statements are not there. Could I be missing something simple and obvious?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在评论中发现输出流的缓冲存在问题。这可以通过调用
flush
语句、非标准flush()
内部子例程或通过编译器特定的环境变量(如GFORTRAN_UNBUFFERED_ALL
。In the comments it turned out that there was a problem with buffering of the output stream. This can be controled by calling the
flush
statement, the non-standardflush()
intrinsic subroutine or by compiler-specific environment variables likeGFORTRAN_UNBUFFERED_ALL
.