LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-04-2014, 11:19 AM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 431

Rep: Reputation: Disabled
Gfortran compilation error. Why?


Hi there. I am trying to restart my fortran which I did years ago but it was a different fortran, FORTRAN IV. So, I have Windows 7==>Oracle VirtualBox==>Ubuntu 12.04 with gfortran installed. I also got a simple-simple source code program with just one executable statement and tried to compile. This is what I got:

alex@alex-VirtualBox:~$ cat fortran_1.f
Code:
PROGRAM HELLO
C	PRINT STATEMENT IS LIKE WRITE
C     but prints to the standard output unit
        PRINT '(A)', 'Hello, world'
        STOP
      END
alex@alex-VirtualBox:~$ gfortran -o fortran_1.f
gfortran: fatal error: no input files; unwilling to write output files compilation terminated.
alex@alex-VirtualBox:~$

What does it all mean? There is no READ statement what would require an input file. Why is it unwilling to write output files?

Also, how come it does not give me an error number? I could have looked it up on the Internet where all errors are numbered.

Thanks, - Alex

Last edited by AlexBB; 05-04-2014 at 11:28 AM.
 
Old 05-04-2014, 11:21 AM   #2
ndc85430
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 92

Rep: Reputation: Disabled
The problem is that you've specified "fortran_1.f" as the output filename, not the input one. You want, e.g.

gfortran fortran_1.f -o fortran_1

This will compile "fortran_1.f" to an executable called "fortran_1".

Last edited by ndc85430; 05-04-2014 at 11:22 AM.
 
1 members found this post helpful.
Old 05-04-2014, 11:33 AM   #3
AlexBB
Member
 
Registered: Mar 2014
Posts: 431

Original Poster
Rep: Reputation: Disabled
Wow! It worked! You are a genious! I ran the object code. Thanks, - Alex
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
compilation problem for gfortran surja Programming 2 07-08-2013 08:58 AM
gfortran: Syntax error in DATA statement at (1) science_guy Programming 1 10-16-2009 01:10 AM
gfortran runtime error saray Linux - Software 1 05-02-2009 11:56 AM
Gfortran compile error aukuntin Linux From Scratch 2 01-28-2007 09:08 PM


All times are GMT -5. The time now is 04:32 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration