Question

So I'm trying to get this program to run, but code blocks throws me this error when I try to run it.

sh: : Permission Denied.

I'm pretty much 100% noob, so links to figure out how to fix it or educational stuff on the issue would be great for learning I think, but any ideas would be helpful really. :)

Was it helpful?

Solution

Correctly set up a project in code::blocks. (I will walk you through setting up a simple Console Application)

Frist Select "Console Application"

Then Select C or C++

Then Set your project Title and location

And then select the default compiler (GNU GCC Compiler)

Finally some template "hello world" code should appear, press F9 to compile and run.

For other future examples Just check out the Code::Blocks User manual: http://www.codeblocks.org/user-manual or Google

note This came from our conversation where we discovered he misc-onfigured Code::Blocks

OTHER TIPS

Not sure what OS you're using.. but if it's Ubuntu, I use CodeBlocks on Ubuntu and have had this exact problem MANY times.

The "user" option (in etc/fstab) by default sets up "noexec".

so in /etc/fstab just add ,exec after user. i.e. mine looks like this: /dev/sda6 /media/DATA vfat uid=kenny,gid=kenny,users,user,exec 0 0 Though, the spacingis a bit off... but you get the idea.

This may be a bit tough if you're new to linux. So google about the fstab file. Also, make back up before you try to edit anything (sudo cp /etc/fstab /etc/fstab.backup)

sudo gedit /etc/fstab will open up the fstab file so you can see if the filesystem has exec in it

I just clicked the Abort button adjacent to Build and Run and it gave this error

permission denied

I solved the problem by going to Build > Select Target > Release

it may be because the directory/file is not given execute permission you can fix this by using command on terminal sudo chmod +x [path to your directory or path to individual file]

like in my case all my codes are in /home/nikhil/code so sudo chmod +x /home/nikhil/code

it worked in my case

If it's an imported project (or you just copied/downloaded it to your hard drive) try rebuilding it.

Start Codeblocks IDE => Open the project => Right click => Rebuild => Click 'Yes' on the prompt.

This happens every time I copy my old projects from USB to HDD after clean system install or system update.

I hope this is the case with you as well, because I tried a lot of 'permission related' solutions first time I encountered this and they didn't get me far.

Best of luck and I'm looking forward to your feedback.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top