Author Topic: SOLUTION for "ERROR: can't save file" - C++ - Leave your solutions!  (Read 4336 times)

Offline hundred4ever

  • Single posting newcomer
  • *
  • Posts: 3

Using codeblocks 16.01 mingw setup, I came across the error where I modified my source file and then tried to save it. No dice. Code::Blocks (CB) wouldn't save any changes.

Trying to find a workaround, as I'm a new user, I opened my .cpp file in Notepad++. It opened, but when I went to save it, it said I didn't have permissions. The file was read-only. So, I figure it was also a permissions problem in CB.

Anyway, I fixed it by making sure the source file was created in the project. After copying my code, I deleted my original source file from my desktop and did the following:


After opening CB > Make sure the project you're working on is open > Highlight that project (on your left, it has a CB icon) > File > New > Empty file > Go through the wizard, file name should have extension .cpp (ex. HelloWorld.cpp) > SAVE > This creates a C++ source file within your project, which should open automatically.

This source file will be available to your left, under Sources.

Paste your code, and it should save!

NOTE: If you don't add the .cpp extension, you'll create a .c file, which is... regrettable if you're a C++ dev, lol.

Good luck, all!

Hope this helps.

Leave a solution or comment.
« Last Edit: October 11, 2017, 01:43:37 am by hundred4ever »

Offline rbatoon

  • Single posting newcomer
  • *
  • Posts: 2
Re: SOLUTION for "ERROR: can't save file" - C++ - Leave your solutions!
« Reply #1 on: January 09, 2018, 09:39:31 pm »
Tried latest version and version 16; using windows pro 64 bit computer (version 10.0.16299.125); can't save any changes; anyone else have any ideas