LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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
  Search this Thread
Old 11-15-2004, 09:34 PM   #1
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27

Rep: Reputation: 15
cannot execute binary file


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
 
Old 11-15-2004, 09:45 PM   #2
mAineAc
Member
 
Registered: Nov 2000
Location: Hermon, ME
Distribution: slackware
Posts: 201

Rep: Reputation: 30
what are the permissions on it? try chmod a+x hello.o and see if that helps
 
Old 11-15-2004, 10:17 PM   #3
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27

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

-rwxr-xr-x hello.o

any other suggestions ??
 
Old 11-15-2004, 10:57 PM   #4
XsuX
Member
 
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43

Rep: Reputation: 15
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.
 
Old 11-15-2004, 11:30 PM   #5
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27

Original Poster
Rep: Reputation: 15
thanx again but , thats doesnt seem to be the problem
 
Old 11-16-2004, 06:52 AM   #6
mAineAc
Member
 
Registered: Nov 2000
Location: Hermon, ME
Distribution: slackware
Posts: 201

Rep: Reputation: 30
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.
 
Old 11-16-2004, 09:33 AM   #7
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
Old 11-16-2004, 10:56 AM   #8
mAineAc
Member
 
Registered: Nov 2000
Location: Hermon, ME
Distribution: slackware
Posts: 201

Rep: Reputation: 30
ok then do:
g++ hello.cpp -o hello
 
Old 11-19-2004, 01:16 PM   #9
Quest101
LQ Newbie
 
Registered: Nov 2004
Posts: 27

Original Poster
Rep: Reputation: 15
mAineAc, thanx for the help , the commands worked !
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 03:08 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
Open Source Consulting | Domain Registration