LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 08-26-2009, 10:54 AM   #1
dolfakar
LQ Newbie
 
Registered: Nov 2006
Posts: 2

Rep: Reputation: 0
Problems executing fortran compiled executable


dear all,

I did a small fortran 90 script of 6 lines:

c****************************
program test
integer :: i
do i=1, 10
write(*,*)'hello there'
end do
end program test
c****************************

I used g95 (fortran compiler for linux) to compile it and make linux executable file,
when I try to run it using "./test.o", it says, "unable to execute binary
any one know what is the issue??

FYI, it is not a permission issue coz I have the "-rwxr-xr-x" permission on the file when I run ls -l command.

any ideas?, help??

regards

Dolf
 
Old 08-26-2009, 11:26 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by dolfakar View Post
dear all,

I did a small fortran 90 script of 6 lines:

c****************************
program test
integer :: i
do i=1, 10
write(*,*)'hello there'
end do
end program test
c****************************

I used g95 (fortran compiler for linux) to compile it and make linux executable file,
when I try to run it using "./test.o", it says, "unable to execute binary
any one know what is the issue??

FYI, it is not a permission issue coz I have the "-rwxr-xr-x" permission on the file when I run ls -l command.

any ideas?, help??

regards

Dolf
Firstly, you should have started a new thread, rather than posting in a really old one. I've reported your post, so it should be split off into its' own thread soon.

Secondly, can you tell us the exact command line you used to compile your program? Also post the output of "file test.o".
 
Old 08-26-2009, 02:17 PM   #3
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
Usually you don't run .o files. They are obtained using option -c of the fortran compiler and they are unusable until they are linked against the needed shared object. If you compile using:
Code:
g95 -o test test.f90
you will obtain a usable executable:
Code:
./test
 
Old 08-26-2009, 06:13 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
IOW, you've created an obj (object file blah.o) and you need to link it against the various libs to obtain an executable/runnable file.
 
Old 08-27-2009, 11:48 AM   #5
dolfakar
LQ Newbie
 
Registered: Nov 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Many thanks Guys, I am able to run the output files,
cheers,

Dolf
 
  


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
Why I cannot run the compiled executable in other pc? christyyim Linux - Newbie 5 12-23-2008 03:18 AM
compile fortran using g77 into executable binary image tuas Programming 2 11-21-2008 10:03 AM
problem with the cross compiled executable??? raklo Linux - Kernel 0 04-03-2007 07:16 AM
Executable compiled w/gcc won't run brancheb Programming 5 05-16-2004 01:56 PM
executing program compiled gcc purusingh Programming 1 08-25-2003 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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