I install Code Blocks from Software Center . I write a C++ program and build it and it was fine. But whenever I try to run the compiled its give me this error: Permission denied . How can I fix this problem .
Ubuntu – Permission Denied error message while running C++ program in Code Blocks
code-blocks
Best Answer
You need the execute permission to run/execute the file. If the file is
/home/user/test.cpp
and you are the owner of the file then to execute the file you need the permission bits like:Here only the owner ('user' in this example) can read, write and execute the file whereas the group ('user' in this case) and all others can only read the file.
To set the permission like this run the following command from Terminal:
If you do so, the execute bit will be set and you will now be able to execute the file.