Thread: Main file deleted

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    23

    Main file deleted

    Hello,

    when I was trying to compile my program under linux with gcc, my main file got deleted(with the main function in it) and it gave me a compile error, because the main function was gone.
    What the hell just happened there? Linux bug? gcc bug?

    Any way to recover this?

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    My guess is that you tried to do something like:

    Code:
    gcc file.c -o file.c
    Which would try to compile the text file "file.c" into an executable called "file.c". If you encountered an error, "file.c" may well have been removed to make way for the resulting executable, and you've lost your source code.

    If this is the case, in future make sure you compile to a separate file - for example, use this instead:

    Code:
    gcc file.c - o file
    If this is not the case, then in order for us to get at the root of the problem you're going to have to post at least (i) the command-line you used and (ii) the output of the command.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you help me about tolower() in file
    By nctar in forum C Programming
    Replies: 7
    Last Post: 05-12-2010, 10:04 AM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM