SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i am new to linux......i installed fortran77 using Yast and it indicates that its installed.when i check the respositories..i dont see the gcc fort4.3...am i supposed to see it? also where do i get the manual for beginners to start with fortran compilers.
Which package did you install exactly? If using the search form in Yast and type "fortran" you end up with gcc43-fortran, which provides the gfortran compiler. To start using it, just write a simple code and try it out:
Code:
gfortran code.f90
If you are looking for a very basic introduction to Fortran, I can suggest this guide from ITS at University of Durham. Feel free to ask if you encounter any problem. Programming questions have to be posted in the Programming forum for a better visibility.
yeap.....but i could not run it.I believe, i have to make it a textfile first....then save it as a textfile.Now when i do ls.....i can see it but when i try to run it .using gfortran code.90...its says :
/usr/lib/gcc/i586-suse-linux/4.3/../../../../i586-suse-linux/bin/ld:code.90: file format not recognized; treating as linker script
/usr/lib/gcc/i586-suse-linux/4.3/../../../../i586-suse-linux/bin/ld:code.90:1: syntax error
collect2: ld returned 1 exit status
by the way i used vim .......newfile in the terminal.On emacs i saved it as test22.
Does it have to be on a directory
This is because fortran compilers in general are very picky about the file names. They have a bunch of extensions which recognize as fortran programs, the other are discarded. In short, just change the extension to .f90 and the trick is done!
i am trying formating......for integers, its refusing me to use e.g.i3
At line 10 of file money.f90 (unit = 5, file = 'stdin')
Fortran runtime error: Expected INTEGER for item 2 in formatted transfer, gotCHARACTER
(2x,i3,a4,f6.2)
^
At line 10 of file money.f90 (unit = 5, file = 'stdin')
Fortran runtime error: Expected INTEGER for item 2 in formatted transfer, gotCHARACTER
(2x,i3,a4,f6.2)
This means that in the read/write statement where you use the format (2x,i3,a4,f6.2) you put a character as the first argument in place of the expected integer. For example:
what is the right syntax to use for an output filename...instead of out.dat....to see only the output file not the contents on the screen.
Thanks
Sorry... I don't understand this question. Where out.dat comes from? Please, post the code you're talking about, otherwise it's difficult for us to guess how it is and where the problem comes from. Thanks.
the program is supposed to write the output ONLY TO A FILE not on the screen, so i am supposed to use:
open(1,file='out.dat').......
by the way....i have been using ./a.out to run my output,so if i wanna name my outputfile so that i dont get confused, but i can see all my outputs as files, what do i use......i want my output to have the same filename as the program.....
Thanks
When you open a file for writing, chose a unit at least greater than 6 or even better a two-digit unit number. The first six units are reserved to some default I/O devices, for example unit 5 is standard input (the terminal) and unit 6 is standard output (the terminal). So use for example
Code:
open(11, file='out.dat')
If you want to determine automatically the name of the output file, based on the name of the executable, you have first to read it using the getarg() function and retrieving argument 0. For example
Code:
PROGRAM test
IMPLICIT NONE
CHARACTER(len=20):: string0
CHARACTER(len=25):: string1
CALL GETARG(0,string0)
string1 = TRIM(string0)//'.dat'
OPEN(11,file=string1)
WRITE(11,*) 'write something now'
CLOSE(11)
END PROGRAM test
this will create an output file called test.dat provided the executable file is simply called test.
Finally to give a name different than a.out to the executable file, you can just rename it at your pleasure or use the -o option to specify it during the compilation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.