Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

an interesting fault with gcc

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
cyborg_o
Posts: 28
Joined: 2005-11-05 16:18

an interesting fault with gcc

#1 Post by cyborg_o »

ok, maybe it's not interesting if you know why, but if you don't it's really strange.

in c with gcc i wrote a program and included math.h

then complied the program
gcc mop.c -o mop.c

then guess what i get


collect2: ld returned 1 exit status

and wha-la the program is gone. even the one i saved. it's the vanishing program fault.
good thing it was a test program only 10 or so lines wrong.

what gives?

geoffb
Posts: 122
Joined: 2005-10-19 18:09
Location: Calgary, AB

Re: an interesting fault with gcc

#2 Post by geoffb »

cyborg_o wrote:ok, maybe it's not interesting if you know why, but if you don't it's really strange.

in c with gcc i wrote a program and included math.h

then complied the program
gcc mop.c -o mop.c

then guess what i get


collect2: ld returned 1 exit status

and wha-la the program is gone. even the one i saved. it's the vanishing program fault.
good thing it was a test program only 10 or so lines wrong.

what gives?
Are you wanting to overwrite the source file with the output file?

cyborg_o
Posts: 28
Joined: 2005-11-05 16:18

#3 Post by cyborg_o »

no. the second mop.c should be a mop

Arkaein
Posts: 39
Joined: 2005-11-05 03:13

#4 Post by Arkaein »

Yes, the second "mop.c" should be just "mop", but are you sure that's what you typed when you compiled it? You typed it wrong in this forum post, you could have just as easily mistyped when you tried to compile, and overwrote the source in some way as you did so.

GCC may have created a temporary object (*.o) file before linking, failed to link because of a missing library, but overwritten mop.c before aborting with an error.

This is a good reason to always use makefiles, even one liners. I'd try again with another short test program, making very sure to output to a different file, and see if you get the same error.

Post Reply