• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Stupid me GCC'd right over my source

I compiled over the top of my source code and my backup is a day old.  Using GCC on Mac OSX 10.4, i.e.

gcc source.c -o source.c

Any idea how I can get my source back?
1 Solution
If you do have you code under some sort of revision control (I doub it) you can replace it with the last checkin. Otherwise you've to start from the backup

Here's a few things to check (in order of "easiness") :

1) Did you use a text editor that takes backups before modifying something (usually something like source.c~ or similar) ?

2) I don't know what file system you use on your Mac OS, but look out for file recovery tools. If you haven't done too much on the disk since the loss, you might be able to recover the file.

3) Just re-write it (assuming there's not too much code that is lost).

4) If all else fails, you have the option of disassembling the object file (in your case source.c since that's what you saved it as). Depending on the level of optimizations, and debugging options, you can get quite a lot out of it. However, typically, you won't get the exact source.
jchristn123Author Commented:
I re-wrote it, and learned a valuable lesson.  Use makefiles and make instead of GCC on the command line.  Thanks infinity
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now