Linux报错cannot execute binary file

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cqchengdan/article/details/88775808

在centos 7上写了一个简单的helloworld,编译执行报错-bash: ./hello: cannot execute binary file

已经使用chmod +x hello加了可执行权限,最后发现是用gcc编译时加了-c参数,

将gcc -o hello -c hello.cpp 改成gcc -o hello  hello.cpp,编译后再执行就没问题了

猜你喜欢

转载自blog.csdn.net/cqchengdan/article/details/88775808
今日推荐