469,963 Members | 1,203 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

What is "ERROR: Wrong magic number"

Hi all,

I written and compiled a c++ program using g++ no errors or
warning are reported.

But when I run it , reporting an error : ERROR: Wrong magic number.

What is the reason for this error?

anybody had an idea ?

--Ravi.T

Sep 26 '07 #1
4 1817
On Sep 26, 5:15 pm, ravi <gototh...@gmail.comwrote:
Hi all,

I written and compiled a c++ program using g++ no errors or
warning are reported.

But when I run it , reporting an error : ERROR: Wrong magic number.

What is the reason for this error?

anybody had an idea ?

--Ravi.T
OS is Linux.gcc3.4.3

Sep 26 '07 #2
ravi wrote:
Hi all,

I written and compiled a c++ program using g++ no errors or
warning are reported.

But when I run it , reporting an error : ERROR: Wrong magic number.

What is the reason for this error?

anybody had an idea ?
That sounds like the OS is having a problem running your executable for
some reason -- perhaps the first few bytes of the executable file are
not what they're supposed to be. Could be a problem with the compiler, a
corrupted file, a hardware issue, or something else.

You didn't post any code, but it seems like the problem might be beyond
that.
--
SM
rot13 for email
Sep 26 '07 #3
"ravi" <go*******@gmail.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
I written and compiled a c++ program using g++ no errors or
warning are reported.

But when I run it , reporting an error : ERROR: Wrong magic number.

What is the reason for this error?
Either you didn't link it, or the file you are executing is not the one you
think it is.
Oct 8 '07 #4
On Oct 8, 7:40 pm, "Andrew Koenig" <a...@acm.orgwrote:
"ravi" <gototh...@gmail.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
I written and compiled a c++ program using g++ no errors or
warning are reported.
But when I run it , reporting an error : ERROR: Wrong magic number.
What is the reason for this error?
Either you didn't link it, or the file you are executing is
not the one you think it is.
He didn't give a too many details, but in a lot of Unix
distributions today, the default $PATH doesn't have . in it
(which is as it should be for non-developers). And I find a lot
of files have the x bit set when they shouldn't. Combine the
two, and that could very easily explain his symptoms.

Depending on the shell being used, either "type command" or
"which command" can be used to see which executable is actually
being found. More generally, however, when testing a just built
executable, it's usually preferable to invoke it with
../filename. (Or maybe I just believe this because so many of my
test programs are called simply test:-), and even with . in the
path, test and ./test invoke different things.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Oct 9 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Chul Min Kim | last post: by
8 posts views Thread by Grant Richard | last post: by
2 posts views Thread by ken.carlino | last post: by
16 posts views Thread by Frederick Gotham | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.