LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 11: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, 12:26 PM   #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, 03:17 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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, 07:13 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 12:48 PM   #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


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

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

All times are GMT -5. The time now is 11: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration