1

I downloaded CodeBlocks and cut and pasted and program I had written earlier which I stored in the Codeblocks folder

The program is simple enough.

    #include <iostream>

    using namespace std;

    int main(){
         cout << "Hello. Watch this space.";
          return -1;
    }

However when I try to compile this program I get this message:

ld.exe||cannot open output file C:\Program Files (x86)\CodeBlocks\MyPrograms\HelloAll.exe Permission denied| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|

Could somebody please explain what this problem is and how I could fix it?

1 Answers1

4

This is an OS-level permission failure as CodeBlocks running under your user does not have access rights to write to C:\Program Files (x86)\CodeBlocks\MyPrograms\.

You should set the output directory to be one you can write to.

nanofarad
  • 40,330
  • 4
  • 86
  • 117