Codeblock 不会运行我的程序,我得到 sh: filepath: Permission Denied Ubuntu 10.04
所以我试图让这个程序运行,但是当我尝试运行它时,代码块会抛出这个错误。
sh: : 权限被拒绝。
我几乎是 100% 菜鸟,所以我认为解决这个问题的链接或有关该问题的教育内容对学习很有帮助,但任何想法都会很有帮助。 :)
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. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果它是导入的项目(或者您刚刚将其复制/下载到硬盘),请尝试重建它。
启动 Codeblocks IDE =>打开项目=>右键单击=>
重建
=>在提示中单击“是”。每次我在全新系统安装或系统更新后将旧项目从
USB
复制到HDD
时,都会发生这种情况。我希望您也是如此,因为我尝试了很多“与权限相关的”
我第一次遇到这个问题的解决方案并没有让我走得太远。
祝您好运,我期待您的反馈。
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
toHDD
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.
在 code::blocks 中正确设置项目。 (我将引导您设置一个简单的控制台应用程序)
首先选择“控制台应用程序”
然后选择 C 或 C++
然后设置项目标题和位置
然后选择默认编译器(GNU GCC 编译器)
最后一些模板“hello world”代码应该出现,按F9编译并运行。
对于未来的其他示例,只需查看 Code::Blocks 用户手册:http://www.codeblocks.org/用户手册或Google
注释这来自我们的对话,我们发现他配置了不同的Code::Blocks
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
不确定你使用的是什么操作系统..但如果是 Ubuntu,我在 Ubuntu 上使用 CodeBlocks,并且多次遇到过这个问题。
“user”选项(在etc/fstab中)默认设置“noexec”。
所以在 /etc/fstab 中只需在 user 之后添加 ,exec 即可。即我的看起来像这样:
/dev/sda6 /media/DATA vfat uid=kenny,gid=kenny,users,user,exec 0 0
虽然间距有点小……但你明白了。
如果您是 Linux 新手,这可能有点困难。所以谷歌搜索一下 fstab 文件。
另外,在尝试编辑任何内容之前请先进行备份(
sudo cp /etc/fstab /etc/fstab.backup
)sudo
gedit /etc/fstab 将打开 fstab文件,以便您可以查看文件系统中是否有
exec
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 hasexec
in it我刚刚单击“构建并运行”旁边的中止按钮,但出现了此错误
我通过转到“构建”> 解决了问题选择目标>发布
I just clicked the Abort button adjacent to Build and Run and it gave this error
I solved the problem by going to Build > Select Target > Release
可能是因为目录/文件没有被授予执行权限,您可以通过在终端上使用命令来修复此问题
sudo chmod +x [目录的路径或单个文件的路径]
就像我的情况一样,我的所有代码都在 /home/nikhil/code 中
所以
sudo chmod +x /home/nikhil/code
它在我的情况下有效
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