LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-17-2011, 05:28 AM   #1
shakena
LQ Newbie
 
Registered: Nov 2011
Location: Greece
Posts: 5

Rep: Reputation: Disabled
fortran f 95


hi im trying to compile one program who calculate the integral of a function with trapeze rule.here is the program.the problem is that i have an error: "file format not recognized,treating like a linker script".what does it mean?????


implicit real*8(a-h,o-z)


OPEN (1,FILE='.\AA.DAT',STATUS='unknown',access='append')

a=1.0d0
b=2.0d0
n=50

call trap(a,b,n,apot)
write(*,30)a,b,n,apot
write(1,30)a,b,n,apot
30 format(2x,'a=',f10.5,2x,'b=',f10.5,2x,'n=',i4,2x,'apot=',f20.15)




n1=100
call trap(a,b,n1,apot1)
error=dabs(apot-apot1)
write(*,30)a,b,n1,apot1
write(1,30)a,b,n1,apot1
write(*,40)error
write(1,40)error
40 format(20x,'error=',d15.2)

stop
close(1)
end




subroutine trap(a,b,n,s)
implicit real*8(a-h,o-z)
f(x)=dexp(-x/2)+dcos(3.5*x)-3/(x-4)
h=(b-a)/dfloat(n)
s=f(a)
x=a
nm=n/2
do 20 i=1,nm
x=x+h
20 s=s/2+f(x)
s=s*h
return
end
 
Old 11-17-2011, 06:03 AM   #2
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
The program compiles fine on my system. Maybe it is some problem with shared libraries installed on your system. If the linker (ld) encounters a shared object which is not binary, it tries to interpret it as a script with instructions on how the link should be done. It would be useful to see the exact command line you used to compile and the complete error message.

Please use CODE tags to improve readability. CODE tags are available in advanced mode by clicking on the # button or you can explicitly write them around the code as
[CODE]some text here[/CODE]
so that it will appear as
Code:
some text here
Thank you.
 
Old 11-17-2011, 02:37 PM   #3
shakena
LQ Newbie
 
Registered: Nov 2011
Location: Greece
Posts: 5

Original Poster
Rep: Reputation: Disabled
fortran 95

ok.Thank you very much for replying.Actually I dont know exactly what I have to do to fix it.I have found another compiler but ,I got the same error message.Do I have to do something else for the shared libraries ???
 
Old 11-17-2011, 02:51 PM   #4
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
Please, show us the complete error message together with the exact command line. There should be some information about what file is "treated like a linked script". The fortran code works, you should provide more information about the issue: what compilers have you tried? What linux OS is this?
 
Old 11-17-2011, 05:28 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
0 members found this post helpful.
Old 11-17-2011, 07:44 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
It certainly appears to me that there is, in fact, nothing wrong with your FORTRAN program. Therefore, "quit pursuing that line of reasoning ... it is a red herring."

I suggest that you start by Googling the exact text of the message (put it in double-quotes). I am entirely sure that colucix is on the right track here. The linker (not the FORTRAN compiler ...) is encountering something that it does not know how to handle, and I shall presume that it's not supposed to be stumbling into whatever-it-is at all.

This sort of thing is what I call ... for lack of a better word ... "a bullsh*t problem." It's the sort of thing that leads you on a merry chase down one false theory after another, only to turn out to be caused by some stupid one-line change in some stupid configuration-file or .bash_profile script or something "off the wall" thing like that. The solution to the problem usually turns out to be quite trivial, and the entire time spent in fruitless pursuit of it is sunk. In short, "a magnificent time-waster."

(And all too familiar to this old man.)

Last edited by sundialsvcs; 11-17-2011 at 07:46 PM.
 
Old 11-18-2011, 03:31 PM   #7
shakena
LQ Newbie
 
Registered: Nov 2011
Location: Greece
Posts: 5

Original Poster
Rep: Reputation: Disabled
fortran 95

I'm using windows 7(32 bit).here is the complete error message that i got:
[CODE] ld:C:\Users\herve bakatamba\Documents\herv\AA.DAT: file format not recognized; treating as linker script
ld:C:\Users\herve bakatamba\Documents\herv\AA.DAT:1: syntax error [CODE]
 
Old 11-18-2011, 03:39 PM   #8
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
Ok. The linker tries to link the file containing your output data! Difficult to tell what's going on without seeing the exact command line you used to compile (if there is a command line in windows environment). The AA.DAT should not be part of the build and the linker should never try to include it in the binary executable. You have to find out how is it possible and exclude it from the compilation.

Please, third time I ask you: show us the exact command line (if any) or tell us how did you run the fortran compiler (if from a graphical interface, maybe a snapshot should be useful).
 
Old 11-21-2011, 03:40 PM   #9
shakena
LQ Newbie
 
Registered: Nov 2011
Location: Greece
Posts: 5

Original Poster
Rep: Reputation: Disabled
fortran 95

Hi,
I dont understand very well what do u mean by the "exact command line".I've just clicked on "run-compile" and then i have all the time this message.
Please can u tell me if u did something else to compile this program before saving it to a file :AA.DAT???
 
Old 11-21-2011, 04:44 PM   #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:
Originally Posted by shakena View Post
Hi,
I dont understand very well what do u mean by the "exact command line".I've just clicked on "run-compile" and then i have all the time this message.
Please can u tell me if u did something else to compile this program before saving it to a file :AA.DAT???
Sorry, but I'm lost now. For exact command line I mean the actual command used to compile, but you already answered my question: if I understand well you're compiling your program in windows environment, using a kind of graphical interface, aren't you? What I don't understand is: what is the AA.DAT file?

It appears in your fortran code as an output file, but the compiler (or better the linker) complains about AA.DAT file format not recognized, etc. etc. The point is: the AA.DAT file should not exist until you are able to run the compiled program. Can you explain where it did come from? I suspect that something in your setup is confusing the fortran code to compile with a generic DAT file that should not have any role in the compilation process.

It would be much better if you could take a screenshot of your compiler interface (that one where you click "Run-Compile") and show us what's the actual set-up.
 
Old 11-22-2011, 08:45 AM   #11
kaiserkarl13
LQ Newbie
 
Registered: Jan 2010
Distribution: Fedora
Posts: 28

Rep: Reputation: 5
Extensions matter

I am guessing that your compiler expects Fortran 90+ files to end in .f90 (most do). FORTRAN 77 files usually end in .f or .for for the same reason. If you called your input file .dat, that's probably why your IDE is complaining.

This is one reason I don't like IDE's....
 
Old 11-22-2011, 01:51 PM   #12
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

In many IDE's (integrated development environments) you start programming by creating a 'project' and adding files to it. Maybe you accidentally add 'aa.dat' to the project and your IDE tries to compile it?

My teacher, who also uses IDE for fortran, told me that if something do not work for unknown reason, it is a good idea to re-create project..

PS. Note that there is a slash in ending /CODE tag.

Last edited by firstfire; 11-22-2011 at 01:55 PM.
 
Old 11-23-2011, 02:26 PM   #13
shakena
LQ Newbie
 
Registered: Nov 2011
Location: Greece
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi,
the "AA.DAT" is simply a name of a "txt" file and I think there is not any relation with the programm error because I tried to complie the program without it and changed it to ".f90",but i got the same error mesage.But can someone tell me how did he do to compile this program??and which compiler did he use?I'm using 'force 2.0' and it doesn't compile it.I tried to use today another compiler called"Plato",it's a worst situation and I receive another kind error message:"THERE IS NO PLUG-IN THAT MATCHES THIS FILE'EXTENSION"Do you know what it is???
 
  


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
Fortran 77 stf92 Programming 6 06-29-2010 11:49 AM
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
where is fortran.h? songqsh Programming 8 04-19-2006 05:42 PM
Gnu Fortran versus Intel Fortran tomatoefish Linux - Software 3 02-20-2006 01:31 PM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:41 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