53

I'M AN IDIOT.

I accidentally typed the wrong command when I was compiling my C++ code with GCC, and guess what?

My .cpp file is gone. The .exe is still there, but that's useless to me right now.

It wasn't an important code, just something I recently started on, but I can't believe I did something so ignorant.

Comments
  • 13
    When I started doing assembly I did many strange things like making executable file by the exact same name of the source code followed by cursing myself for 10 minutes XD...
    Enjoy...
  • 7
    @VTCoder
    I guess I'm not the only one who makes silly mistakes. :)

    But this isn't my first time using C++, so I guess that makes me more stupid lol.
  • 7
    @Michelle yeah we tend to do this even after being experienced..... Humans we are you see....
  • 5
    @VTCoder
    Oh, true. That makes me feel better haha.
  • 12
    To avoid such mistakes in the future, use a majefile. That way you won't have to type the command every time (or be lazy and just arrow up until it's there ;))
    Oh and use git locally :P
  • 8
    @Michelle use version control, like Git, even for scrap things.

    git init // to init new repo
    git add --all && git commit -m "some scrap message"

    Maybe alias it for even lower footprint. (These two commands are in gcrap alias for me)
  • 5
    @RantSomeWhere The source file and output file were switched. Trying to compile "test.exe" into "test.cpp". So GCC deleted the .cpp file and then failed to compile what it expected to be source code from the .exe

    I've done that before.
  • 2
    Just repeat after me "To hell with the .cpp file".
  • 3
    @rootkali XD
    To hell with all those deleted codes...
  • 4
    Learn git. It's not hard and saves your life.

    https://try.github.io/levels/1/...
  • 3
    This is why you VCS.
  • 1
    Working on your own os, huh?
  • 2
    @uyouthe
    Wow you actually remember. :D

    So many devRant users remember so many things about me whether it's about my projects or family or school, and it feels great. :)
  • 1
    @Michelle how it’s going? Read some literature or just inventing everything from scratch?

    Monolithic kernel or microkernel though?
  • 1
    @uyouthe
    I'm thinking monolithic since the processing will be faster.

    I'm trying to build everythong from scratch, but if it's too much work, I'll use an existing kernal, but for now it's all going to be from scratch.
  • 1
    Install "Local History" plugin in your favourite IDE/Text Editor (Jetbrains has it internally). It keeps previous copies (somewhere outside the project) of the file you are editing whenever you save it. It saved me from ton of work multiple times. Also Git doesn't help if you overwrite the file with different contents and you didn't commit changes before.
  • 2
    Use some git backups, can always be useful!
Add Comment