Why is Gfortran not printing on Cygwin?

In summary, there is a difference between using "run" and directly executing the program in the command window. When using "run", the output may not be visible as it is displayed in a different process.
  • #1
kth
4
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
  • #2
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.
 
  • #3
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?
 
  • #4
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.
 

What is Gfortran printing on Cygwin?

Gfortran printing on Cygwin refers to the process of using the Gfortran compiler to print output from Fortran programs on a Cygwin environment. Cygwin is a Unix-like environment that allows Windows users to run Linux and Unix software.

How do I install Gfortran on Cygwin?

To install Gfortran on Cygwin, you will need to use the Cygwin installer. Select the "gcc-gfortran" package from the list of available packages and follow the installation instructions. Once installed, you can use the "gfortran" command to compile and run Fortran programs.

What are the benefits of using Gfortran on Cygwin?

Using Gfortran on Cygwin allows you to run Fortran programs on a Windows environment without having to use a virtual machine or dual-boot setup. This can save time and resources for those who need to use both Windows and Linux/Unix software.

How do I print output from a Fortran program on Cygwin?

To print output from a Fortran program on Cygwin, you can use the "print" or "write" statements in your code. Alternatively, you can redirect the output to a file by using the ">" symbol after the program name when running it, such as "myprogram.exe > output.txt".

Are there any limitations to printing with Gfortran on Cygwin?

There are no specific limitations to printing with Gfortran on Cygwin. However, since Cygwin is a Unix-like environment, there may be differences in how certain printing commands are executed compared to a Windows environment. It is always recommended to test and troubleshoot your code on both platforms to ensure proper functionality.

Similar threads

  • Programming and Computer Science
Replies
1
Views
681
  • Programming and Computer Science
Replies
5
Views
998
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
2
Views
649
  • Programming and Computer Science
2
Replies
43
Views
2K
  • Programming and Computer Science
Replies
17
Views
2K
Replies
1
Views
649
  • Programming and Computer Science
Replies
1
Views
555
Replies
17
Views
7K
  • Programming and Computer Science
Replies
17
Views
2K
Back
Top