请教 cannot execute binary file问题

来源:互联网 发布:java cpu利用率 编辑:程序博客网 时间:2024/05/17 04:14
在root用户下执行test下面的MiniServer文件

原文:
[root@localhost test]# ./MiniServer
-bash: ./MiniServer: 权限不够


PS: 然后我用chmod u+x MiniServer 命令:

出现下文:
[root@localhost test]# chmod u+x MiniServer
[root@localhost test]# ./MiniServer
-bash: ./MiniServer: cannot execute binary file

以后执行这个文件都是提示: -bash: ./MiniServer: cannot execute binary file

这个问题困扰了我三天.重做3次系统..:0w223dc .


你的不要使用-c参数。这样gcc TCPEchoServer4.c -o TCPEchoServer4,这样就可以直接./TCPEchoServer4了。


第一种可能:
MiniSerer不属于root用户,所以chmod u+x MiniServer后并没有给root执行权限。
第二种可能:
该文件所属的文件系统不允许执行。


第一.这个文件是是root权限的可执行文件
第二.服务器CPU是32位.linux系统是I386编译的..所以编译环境是匹配的.

方法:g++ -o test test.cpp 或者gcc -o test test.cpp 保证通过,在google,baidu,bing上搜了好长时间终于在一个犄角旮旯里找到了最终的解决方案,希望碰到这样问题的童鞋们,能够尽快解决这个问题。


原创粉丝点击