LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices

Reply
 
Thread Tools
Old 11-15-2004, 10:34 PM   #1
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27
Thanked: 0
cannot execute binary file


[Log in to get rid of this advertisement]
Hey ,
I am trying to execute a simple binary file hello.o on Red hat 9.0

i enter the commnand : ./hello.o

The error message received is : bash: ./hello.o: cannot execute binary file

any help would be greatly appreciated
Quest101 is offline     Reply With Quote
Old 11-15-2004, 10:45 PM   #2
mAineAc
Member
 
Registered: Nov 2000
Location: Hermon, ME
Distribution: slackware
Posts: 201
Thanked: 0
what are the permissions on it? try chmod a+x hello.o and see if that helps
mAineAc is offline     Reply With Quote
Old 11-15-2004, 11:17 PM   #3
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27
Thanked: 0

Original Poster
mAineAc thanx but i had already tried that the permission printout for the file look like :

-rwxr-xr-x hello.o

any other suggestions ??
Quest101 is offline     Reply With Quote
Old 11-15-2004, 11:57 PM   #4
XsuX
Member
 
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43
Thanked: 0
Is it a C/C++ program? If so, then do you have the source code? If so, then try recompiling it. I had trouble like this on my university's UNIX server, and some weird bug makes it so you have to recompile almost everytime you run the prog.
If my assertions were wrong, then ignore this post, cuz it offers nothing.
XsuX is offline     Reply With Quote
Old 11-16-2004, 12:30 AM   #5
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27
Thanked: 0

Original Poster
thanx again but , thats doesnt seem to be the problem
Quest101 is offline     Reply With Quote
Old 11-16-2004, 07:52 AM   #6
mAineAc
Member
 
Registered: Nov 2000
Location: Hermon, ME
Distribution: slackware
Posts: 201
Thanked: 0
is this a program you wrote? If it is, is there any way you can share the source so that we can see what the problem is? You will get an error like that if you are trying to use some win api. like if you wrote it and compiled it with winc++ You didn't give any information about how it was compiled, written or anything except your trying to run it on rh 9. It is kinda hard to help a person in the dark.
mAineAc is offline     Reply With Quote
Old 11-16-2004, 10:33 AM   #7
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27
Thanked: 0

Original Poster
Hey i am jus trying to compile a simple hello world program .....

#include<iostream>
using namespace std ;

int main ()
{
cout << "hello " ;
return 0 ;
}

i saved it as hello.cpp

from the command terminal i used gcc :

gcc -c hello.cpp

which was good since it compiled giving a hello.o file

this was where i encountered the problem. In trying to execute the program:

./hello.o

i got the error message]

bash: ./hello.o: cannot execute binary file

I hope this information give u a clearer pic of what the problem actually is , thanx for the help
Quest101 is offline     Reply With Quote
Old 11-16-2004, 11:56 AM   #8
mAineAc
Member
 
Registered: Nov 2000
Location: Hermon, ME
Distribution: slackware
Posts: 201
Thanked: 0
ok then do:
g++ hello.cpp -o hello
mAineAc is offline     Reply With Quote
Old 11-19-2004, 02:16 PM   #9
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27
Thanked: 0

Original Poster
mAineAc, thanx for the help , the commands worked !
Quest101 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
cannot execute binary file babaliciouse Linux - Software 2 10-21-2004 12:50 PM
Cannot execute binary file pbagda Linux - General 4 01-19-2004 02:13 AM
Cannot execute binary file??? Wimpie22 Linux - General 3 01-11-2004 05:38 PM
Cannot execute binary file Nooodle007 Linux - Software 2 06-25-2003 02:25 PM
cannot execute binary file.... ttaylor Linux - General 4 10-02-2001 02:37 AM


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

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration