看来由于我安装了最新版本的 GCC,如果我想更改输出文件,我将无法再编译任何 C 文件。举个例子,文件hello.c
:
#include <stdlib.h>
#include <stdio.h>
int main()
{
printf("hello\n");
}
如果我做 :
gcc hello.c
它工作正常,我有a.out
输出。但是如果我想更改输出的名称,我基本上应该这样做:
gcc -o hello.c hello
我对吗?
如果是这样,我会收到此错误:
gcc: error: hello: No such file or directory
gcc: fatal error: no input files
compilation terminated
再举一个例子,它完全是 WTF :
gcc -o Simplexe.c Simplexe
Simplexe: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o:(.fini+0x0): first defined here
Simplexe: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o:(.data+0x0): first defined here
Simplexe: In function `__data_start':
(.data+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o:(.data+0x0): first defined here
Simplexe:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o:(.rodata.cst4+0x0): first defined here
Simplexe: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o:(.text+0x0): first defined here
Simplexe: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
Simplexe:(.dtors+0x8): first defined here
/usr/bin/ld: error in Simplexe(.eh_frame); no .eh_frame_hdr table will be created.
我从未见过这样的东西,它删除了我的源文件。我被抓过一次,以后再也不会了。