Fortran 中的 print 语句没有输出

发布于 2024-12-15 01:54:14 字数 344 浏览 2 评论 0原文

我已经编译了一个在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

来日方长 2024-12-22 01:54:14

在评论中发现输出流的缓冲存在问题。这可以通过调用 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-standard flush() intrinsic subroutine or by compiler-specific environment variables like GFORTRAN_UNBUFFERED_ALL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文