测了一下,确实是这样的,下面编译之后的错误信息:
hello: file not recognized: File truncated
collect2: ld returned 1 exit status
编译器要生成可执行文件,因为-o hello.目标文件是hello,但是编译后有错误:file not recognized.然后就执行:File truncated.可以理解为文件被删除了。
但是你这样编译就没有问题:gcc -Wall hello -o app,hello不会被删除,错误信息如下:
hello: file not recognized: File format not recognized
collect2: ld returned 1 exit status