LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2007, 08:54 AM   #1
Vassos
Member
 
Registered: Jul 2007
Posts: 52

Rep: Reputation: 15
fortran compiler f95


Hey
i downloaded gcc , propably the latest version on my 'Fedora 7.
I am trying to compile a simple program.
If i save the program as <name>.f i get this message:
PROGRAM ela
1
Error: Non-numeric character in statement label at (1)
In file ela.f:1

PROGRAM ela
1
Error: Unclassifiable statement at (1)
In file ela.f:2

PRINT * ,'satanas'
1
Error: Non-numeric character in statement label at (1)
In file ela.f:2

PRINT * ,'satanas'
1
Error: Unclassifiable statement at (1)
In file ela.f:3

END
1
Error: Non-numeric character in statement label at (1)
In file ela.f:3

END
1
Error: Unclassifiable statement at (1)


Then if i save it as <name>.f95 and compile it again i get no errors. But the executable file does not work.
Any suggestions?
Is it possible to put also the f77 compiler to on my system?
 
Old 08-05-2007, 09:38 AM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Try sudo yum install compat-gcc-34-g77 compat-libf2c-34

But I'd suggest you first look at info gfortran for suggestions about getting the f95 program to run.
 
Old 08-05-2007, 02:34 PM   #3
Vassos
Member
 
Registered: Jul 2007
Posts: 52

Original Poster
Rep: Reputation: 15
thanks for the help But,...
Ok i checked the manual , i also checked the official site and it seems that everything should have been working .
With the something.f files it never works .
But with the something.f95 everything is fine.
I compile it , i get an executable file, and then the file does Nothing...!
I don want do download the g77 ,since the manual says that its ok compiling older fortran formats, and i dont wan to mix up things by downloading stuff.

I am a newbie so i know nothing about the sourcecodes , or about the libraries maybe is somethin to do with these things.
 
Old 08-05-2007, 05:31 PM   #4
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Do you have libgfortran installed? gcc-gfortran?

compat-lib2c-34 might also be useful.
 
Old 08-06-2007, 10:23 AM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Can you show us your F95 code? (If you paste the code into a message, put it between "code" tags. I.e., a [ code ] and [ /code ] with no spaces within the brackets, or, if you're using the "reply" form instead of the default "quick reply" one, just highlight the code an click the "#" button at the top of the input form.)

I suspect that you're missing a library, but I'm surprised that you got an executable file if the library isn't available.
 
Old 08-06-2007, 11:01 AM   #6
Vassos
Member
 
Registered: Jul 2007
Posts: 52

Original Poster
Rep: Reputation: 15
i have everything!
But it doesnt work. I dont realy know why.
is there a way of uninstalling them so i can pu them back again?
 
Old 08-06-2007, 11:11 AM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by Vassos
I compile it , i get an executable file, and then the file does Nothing...!
Does it really do nothing or does it give some errors? What is it expected to do? Can you post the code or the relevant parts of the code, as PTrenholme suggested?
 
Old 08-06-2007, 05:20 PM   #8
Vassos
Member
 
Registered: Jul 2007
Posts: 52

Original Poster
Rep: Reputation: 15
the code is really sipmle i just did it to check if the compiler works
[program test print*,'pls work..' end]

Then i saved the fil as .test.f95
and this is what happens in the terminal when i compile and try to execute:

[vassos@localhost fortr]$ f95 test.f95 -o test
[vassos@localhost fortr]$ test
[vassos@localhost fortr]$ dir
test test.f95
[vassos@localhost fortr]$
 
Old 08-06-2007, 06:25 PM   #9
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Try using the standard executable output:
Code:
$ echo "program test;print *,'Please work . .';stop;end" > test.f95
$ f95 test.f95
$ ls
a.out  test.f95
$ ./a.out
 Please work . .
$
For some reason, using the -o option doesn't seem to work.
<edit> Ah, yes. (See below) It did work, there's just a "test" command
Code:
$ which test
/usr/bin/test
in my (and your) path. (Actually, "test" is a bash built-in command. I'd forgotten that since I almost always use the "[" test command alias.)

Another suggestion: Try naming your executables using upper-case letters. Almost all Linux command use mixed case.
</edit>

(I don't know if the "stop" is really needed, but it doesn't hurt to flush the buffers.)

You might want to look at the kdevelop package if you're using KDE -- it supports standard project development for any of the gcc-supported languages.

Last edited by PTrenholme; 08-07-2007 at 03:22 PM.
 
Old 08-07-2007, 01:07 AM   #10
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
[vassos@localhost fortr]$ f95 test.f95 -o test
[vassos@localhost fortr]$ test
[vassos@localhost fortr]$ dir
test test.f95
[vassos@localhost fortr]$
Here is the problem: you are executing the linux test command, not really the program you have just compiled. To be sure to execute the command which is in your current directory, you should launch it with its relative path:
Code:
./test
as in the example of PTrenholme for launching the a.out executable. Just a little of experience, then you will type ./ automatically!
 
Old 08-07-2007, 02:09 AM   #11
Vassos
Member
 
Registered: Jul 2007
Posts: 52

Original Poster
Rep: Reputation: 15
YEEEEES! thanks a lot.
It worked finally. Just by using the ./ before calling the program.
And the -o command works to.

I have a question though what is the difference of using ./ ??
Some times when i am installing something while usinh configure, or make install , i have to use ./ and some times not
why is that???
 
Old 08-07-2007, 02:20 AM   #12
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Vassos
I have a question though what is the difference of using ./ ??
Some times when i am installing something while usinh configure, or make install , i have to use ./ and some times not
why is that???
http://www.linuxquestions.org/questi...57#post2848357
 
Old 08-07-2007, 02:38 AM   #13
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
When you launch a command on Linux/Unix the system looks for that command on some directories. These are the directories listed in your environment variable called PATH. Try
Code:
echo $PATH
to inspect your own PATH. When an executable that matches the name you've typed on the command line, is encountered along the PATH, it is executed.
But you can also launch a command specifying its absolute or relative path: for example, if you have an executable called test in /home/vassos/fortr you can launch it with its absolute path, despite the directory you're currently into:
Code:
/home/vassos/fortr/test
or with its relative path... relative to the directory you're currently into:
Code:
cd /home/vassos/fortr
./test
or
Code:
cd /home/vassos/anotherdir
../fortr/test
This is the reason why typing simply test and not ./test, the system has executed the shell command test: it has encountered an executable called test along the PATH and has executed it. Simply. You can verify where the test command is located by:
Code:
which test
Cheers.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
Can't get a Fortran compiler Executor21 Linux - Newbie 1 01-15-2007 11:29 AM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM
where can i download a free f95 compiler ztdep Programming 1 07-20-2005 07:50 PM
Fortran Compiler bob10a Linux - Software 14 07-19-2003 04:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration