Author Topic: cpp/h files dissappeared, program still functioning though  (Read 3903 times)

sieg581

  • Guest
cpp/h files dissappeared, program still functioning though
« on: October 23, 2013, 07:01:56 am »
I'm new to programming, I've been working on a small text-based rpg, I closed Code::Blocks, I remember it asking me something about "The default has changed, save changes?" I restarted my laptop for an irrelevant reason, when I opened up the project again and went to add a file, the cpp/h files were gone and the only cpp file was "main.cpp" and all it had was the Hello World cpp file, project.depend project.layout, project.cbp, obj, and bin. Also, the project files (the 3 cpp and header file that made the project up) reappeared in the "devprjs" folder, not a road block or anything but I'm curious why this happened?
« Last Edit: October 23, 2013, 07:39:54 am by sieg581 »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: cpp/h files dissappeared, program still functioning though
« Reply #1 on: October 23, 2013, 10:13:46 am »
You have to hit the "save all" button, to save the project file. I think if you don't do this, C::B will ask you at the end if you want to save the project file, and it will also ask if it should save the layout. You can readd your files by right click on the project and "add files".

greetings

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: cpp/h files dissappeared, program still functioning though
« Reply #2 on: October 23, 2013, 03:52:21 pm »
I'm new to programming, I've been working on a small text-based rpg, I closed Code::Blocks, I remember it asking me something about "The default has changed, save changes?" I restarted my laptop for an irrelevant reason, when I opened up the project again and went to add a file, the cpp/h files were gone and the only cpp file was "main.cpp" and all it had was the Hello World cpp file, project.depend project.layout, project.cbp, obj, and bin. Also, the project files (the 3 cpp and header file that made the project up) reappeared in the "devprjs" folder, not a road block or anything but I'm curious why this happened?
You did not save the project. Which means you're lucky, because contrary to the appearance, your work is not "gone".

The "project" is the meta-information which tells Code::Blocks what to do, for example: compile these 3 files into one program. It is saved in the .cbp file.

However, in your case, it appears that you've generated a new project using the wizard (which will write the default cookie-cutter project as well as the silly Hello World main.cpp to disk). Then you did some work, creating those 3 files, and adding them to the project, but you did not save the project (even when asked). Therefore, the files appear "gone". Just re-add them, and save the project. :)

And while you're at it, you can delete the main.cpp file that contains Hello World, you're not going to need it (oh how much I hate this file, every single time for every new project... grr...).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."