Why is Gfortran not printing on Cygwin?

  • Context: Fortran 
  • Thread starter Thread starter kth
  • Start date Start date
  • Tags Tags
    Gfortran Printing
Click For Summary
SUMMARY

The issue with Gfortran not printing output in Cygwin is due to the execution context of the commands used. When executing with the command `./a.exe`, the program runs in the same shell, allowing output to be displayed directly in the command window. Conversely, using `run a.exe` opens a new shell, which results in the output being sent to a different process, thus not appearing in the original command window. To ensure visibility of output, users should execute the program directly in the shell rather than through the `run` command.

PREREQUISITES
  • Understanding of Gfortran syntax and commands
  • Familiarity with Cygwin environment
  • Basic knowledge of shell command execution
  • Experience with Fortran I/O operations
NEXT STEPS
  • Research Gfortran I/O operations and their behavior in different environments
  • Learn about shell command execution in Cygwin
  • Explore methods to prevent command window closure after execution
  • Investigate differences between running executables in various shells
USEFUL FOR

This discussion is beneficial for Fortran developers, Cygwin users, and anyone troubleshooting output issues in command-line environments.

kth
Messages
3
Reaction score
0
I use gfortran on cygwin and i want to print in the command window (like it prints in windows)
i use the usual stuff:

WRITE(6,*) 'Give a number:'

or

PRINT(6,*) 'Give a number:'

but the execution completes without any printing..

What is wrong?
 
Technology news on Phys.org
Does the 'black window' stays on the screen without printing anything, or does it disappears without giving you time to read what's on it?

In the former case, we will need more information.

In the latter case, it is probably because the window shuts down at the end of the execution unless you put a command to halt the closing, such as requesting user to enter a key to continue.
 
When i use the command

./ a.exe it prints int the command window

but when i use

run a.exe it does not print

I wonder what's the difference between those commands?
 
I do not have a Linux system to verify the explanation, but I believe the run command opens a new shell so printing is displayed in a different process distinct from where you entered your command "run...". On the other hand, a.exe is executed in the command screen, so you get to see the output.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
5K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 3 ·
Replies
3
Views
5K