我使用 gcc -o main -c main.c 生成了的 main文件, 结果一运行他就说cannot execute binary file , 使用了 chmod 777 main 还是不行,找了很多的资料,只要 gcc -o main main.c把-c 去掉就可以了。
我就 man gcc 了下,在他的说明下: -c option is to say not to run the linker ,then the output consist s of object files output by the assembler 。 原来是没有连接的缘故,这个选项和linux上的GCC还是有差别的。