./命令没有用
Tofloor
poster avatar
a2367994141
deepin
2016-01-20 02:14
Author
本帖最后由 a2367994141 于 2016-1-19 18:44 编辑

我在deepin下的终端使用gcc生成的a.out文件。直接./a.out不行啊,我用其他linux版本的时候都可以,为什么这里不行呢??
求助!!



Reply Favorite View the author
All Replies
somethingbad
deepin
2016-01-20 02:29
#1
检查您的out文件有没有控制台输出
Reply View the author
136******54
deepin
2016-01-20 02:35
#2
本帖最后由 diyiliaoya 于 2016-1-19 18:37 编辑

有没有在a.out所在的目录下?你这个a.out是在终端下生成的还是从别的地方拷过来的?你说它不能运行,那么报了什么错?
Reply View the author
a2367994141
deepin
2016-01-20 02:36
#3
https://bbs.deepin.org/post/36346
检查您的out文件有没有控制台输出

为了防止代码错误,我只写了一个printf,我./a.out  就会说权限不够,然后sudo ./a.out就提示sudo: ./a.out: command not found
Reply View the author
ManateeLazyCat
deepin
2016-01-20 02:37
#4
你要给这个文件可执行权限啊
Reply View the author
a2367994141
deepin
2016-01-20 02:38
#5
https://bbs.deepin.org/post/36346
有没有在a.out所在的目录下?你这个a.out是在终端下生成的还是从别的地方拷过来的?你说它不能运行,那么报 ...

是在终端使用gcc生成的。我在4楼还有详细的回复。。
Reply View the author
a2367994141
deepin
2016-01-20 02:39
#6
https://bbs.deepin.org/post/36346
你要给这个文件可执行权限啊

sudo chmod 777 a.out  给了权限还是不行。
Reply View the author
ManateeLazyCat
deepin
2016-01-20 02:49
#7
https://bbs.deepin.org/post/36346
sudo chmod 777 a.out  给了权限还是不行。

sudo chmod +x ./a.out
Reply View the author
136******54
deepin
2016-01-20 02:52
#8
不要在u盘里编译运行,把文件拷到电脑里再编译运行
Reply View the author
a2367994141
deepin
2016-01-20 02:54
#9
https://bbs.deepin.org/post/36346
sudo chmod +x ./a.out

使用你给的命令后,没有出现任何提示信息,可是代码里有个printf的,也没有输出。。我测试过在unbuntu下是有输出的。应该不会是代码错误吧。。
Reply View the author
a2367994141
deepin
2016-01-20 02:58
#10
https://bbs.deepin.org/post/36346
不要在u盘里编译运行,把文件拷到电脑里再编译运行

可以了 ,非常谢谢误大家,原来是不能在u盘里运行。。。。。。谢谢这位大神
Reply View the author
loveidmy
deepin
2016-01-21 07:10
#11
我是这样做的
sudo su
./a.out
Reply View the author
cxbii
deepin
2016-01-21 22:45
#12
https://bbs.deepin.org/post/36346
可以了 ,非常谢谢误大家,原来是不能在u盘里运行。。。。。。谢谢这位大神 ...

你U盘是Fat32格式的吧?非Unix的文件系统都不支持Linux的权限要求的
Reply View the author
android
deepin
2016-01-21 23:16
#13
文件系统不支持linux的权限啊
Reply View the author