PDA

View Full Version : executable a.out doesn't seem to execute!



daviddoregan
February 10th, 2006, 12:22 AM
I'm pretty much a beginner to both Linux and programming.

Using g77 compiler, build-essential installed on Breezy.
I compile .f files, which generate a.out a binary executable.
Double clicking on a.out doesn't have any effect!

If I enter

./a.out > file

and then read file, I can see the results of my program.
But I can't figure out a way to see the results of my program just using executing a.out. Should I open a.out with some specific program?
Please help!

Mlehliw
February 10th, 2006, 03:06 AM
Did you try just typing './a.out' alone in a terminal.

The '>' symbol redirects the output of a command into a file. In your case, the output of your program that normally would display on a terminal was being redirected into file, which you then were able to read.

daviddoregan
February 10th, 2006, 02:16 PM
Perfect thanks! this step was so obvious that it wasn't in any help file :rolleyes:

skirkpatrick
February 10th, 2006, 02:27 PM
As a side note, double-clicking a command-line program from nautilus causes it to execute. Now depending on whether you told Nautilus to just run it or run it in a console will depend on what you see. Of course if the program doesn't wait for something to happen when you run it in console from Nautilus, the console will close as soon as the program is finished.

daviddoregan
February 10th, 2006, 03:21 PM
yeah it was Nautilus I was trying to use.
Here is my first tiny little FORTRAN 77 program:

* *** COMPOUND INTEREST CALCULATION

BALNCE = 1000
RATE = 0.09
RINT = RATE * BALNCE
BALNCE = BALNCE + RINT
PRINT*, 'NEW BALANCE IS', BALNCE
STOP
END

Is there a way I can alter this so that the answer stays on the screen when I run a.out by double-clicking on it in Nautilus? *beginner*

skirkpatrick
February 11th, 2006, 03:58 AM
Not sure how to do it in Fortran.

engla
February 11th, 2006, 04:11 AM
Is there a way I can alter this so that the answer stays on the screen when I run a.out by double-clicking on it in Nautilus? *beginner*
You can solve it in two ways basically: either in your FORTRAN code or in your terminal settings.

I. Insert an infinite loop at the end of your program. I have no idea how to write that in fortran, but it shouldn't be hard. When you want to quit the program, you can type ctrl-C to interrupt it.

II. Modify your terminal profile. Normally, it's set to close the terminal when a command exits. Set it to keep the window open.

mjh007
February 24th, 2006, 08:18 AM
II. Modify your terminal profile. Normally, it's set to close the terminal when a command exits. Set it to keep the window open.

I'm also new to Fortran programming in Linux. Have used VF in windows. How do you go about doing the above.

e.g. if I have write(*,*) in my program, how do I see the results on my screen without the terminal closing immediately?

jerome bettis
February 24th, 2006, 08:41 AM
we should really have a sticky thread on how to write, compile, and run hello world. this comes up every day. \\:D/