Rupert Wood me@rupey.net
Fri Nov 11 15:48:00 GMT 2005

John Love-Jensen wrote:

> > Is there something that i can do to change that?
> Yes, you should put the -o just before the desired output filename
> parameter.

I imagine he means "I just overwrote my source, can I get it back?"

I also imagine he means compiling the source, not the last binary, i.e.

    gcc -o name.c name.c

else it wouldn't work. And GCC will happily do that, I know from bitter
experience: back in my student days, late the night before a deadline on too
much coffee. So you have my sympathy.

Whether you can get the file back depends on your OS and filesystem - there
might still be a copy somewhere in unallocated space you can recover, but
I'd guess not - and your editor might have saved a last version backup if
you're using something fancy: have a quick look around your home directory
and your temporary files.

The lesson you've learned the hard way is that even when you're writing
simple stuff, only a few hours work, you still need to back it up regularly.
A good way is simple version control like a local subversion repository;
commit to it every time you make a bit of progress and write meaningful
commit comments. That's fairly cheap in terms of time and space, convenient
to use, you've got useful history if you come back to dig through later and
you've still got access to chunks of code you've since thrown away, etc.


More information about the Gcc-help mailing list