PDA

View Full Version : gfortran unable to write/print to screen




bjornkoop
Oct 14, 2010, 04:17 AM
Hello,

I've been trying to find a solution for a few days now, but with no luck yet. Hopefully somebody here can help me.
I have installed gfortran on my mac (10.6.4) and it works ok, apart from one little thing. If I program a .f90 file to print/write to screen, nothing is displayed on the screen. It does create an output file, but it should also show the result on the screen. The previous time I had it installed (on osx 10.5.xx if I remember right) it did work. I am using the terminal to execute the fortran files using gfortran xxx.f90 command (xxx is filename). If nobody can help me, maybe somebody can explain to me how to get gfortran to work in xcode 3.2.4. I seem to be unable to figure that one out.

Thanks in advance,

Björn



breatheasy
Oct 14, 2010, 04:29 AM
This may sound like a silly question, but are you actually executing the files or just compiling them?

gfortran is a compiler, so you need to use gfortran XXX.f90 to compile the program then you need to execute the program by running ./a.out

bjornkoop
Oct 14, 2010, 05:19 AM
Hmm, stupid of me. That was indeed the problem! Forgot that after all the time I haven't used it. Thank you for the quick reply! But is there an easy way to compile and build the files with xcode? I don't really like it to use terminal for it though it works. But since I also write the programs in xcode, it would be nice to be able to compile and build it with the same program. I have tried a few different possibilities, but all are for earlier versions of xcode and don't work for me (or I am doing something wrong ofcourse). I use Xcode 3.2.4. I found some things about gfortran project and plugin, but somehow I don't really get what to do and the way I do it (which is in my case it is explained to do it) doesn't work.
Hope somebody can help me with that.

Björn

breatheasy
Oct 14, 2010, 06:00 AM
I'm sure you can change the compiler somewhere in the project settings, but in my opinion with fortran you can't really beat a good text editor(aquamacs,vi,even just the editor component of xcode), the terminal and makefiles.

bjornkoop
Oct 14, 2010, 06:11 AM
Hmm, well, guess I will just stick with terminal then and xcode as editor. But thanks anyway