3
나는 일사천당에 빠져 있습니다. 이것은 내가 GCC작은 안녕하세요 세계 프로그램에서 거대한 오류를 반환하는 gcc
gcc -lm -g -o bin/tomashell obj/tomashell.o obj/tomashell.o: In function `_start': (.text+0x0): multiple definition of `_start' /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 10 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 11 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 12 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 13 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 14 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 15 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 16 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 17 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 18 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 19 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 21 has invalid symbol index 14 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 22 has invalid symbol index 22 /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_line): relocation 0 has invalid symbol index 2 /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o:/build/buildd-eglibc_2.11.2-10-i386-GapcyD/eglibc-2.11.2/csu/../sysdeps/i386/elf/start.S:119: first defined here obj/tomashell.o:(.rodata+0x0): multiple definition of `_fp_hw' /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o:(.rodata+0x0): first defined here obj/tomashell.o: In function `_fini': (.fini+0x0): multiple definition of `_fini' /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crti.o:(.fini+0x0): first defined here obj/tomashell.o:(.rodata+0x4): multiple definition of `_IO_stdin_used' /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o:(.rodata.cst4+0x0): first defined here obj/tomashell.o: In function `__data_start': (.data+0x0): multiple definition of `__data_start' /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o:(.data+0x0): first defined here obj/tomashell.o: In function `__data_start': (.data+0x4): multiple definition of `__dso_handle' /usr/lib/gcc/i486-linux-gnu/4.4.5/crtbegin.o:(.data+0x0): first defined here obj/tomashell.o: In function `_init': (.init+0x0): multiple definition of `_init' /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crti.o:(.init+0x0): first defined here /usr/lib/gcc/i486-linux-gnu/4.4.5/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__' obj/tomashell.o:(.dtors+0x4): first defined here collect2: ld returned 1 exit status make: *** [bin/tomashell] Error 1
에서지고있어 오류입니다 그리고 이것은 내 전체 코드 파일입니다
#include <stdlib.h>
#include <stdio.h>
int main()
{
printf("Hello, world!");
}
내가이 컴파일되지 않는 이유 사소한 단서를 가지고 있지 않습니다. 다른 모든 C 응용 프로그램을 컴파일해도 괜찮습니다.
컴파일러 호출은 어떤 모양입니까? 개체 파일에 원하지 않는 내용이 들어있는 것 같습니다. 파일에'_start'가있는 것처럼 보일 수도 있습니다. 파일 이름 확장자처럼 단순한 객체 파일이 아니라 실행 파일에 컴파일 된 것처럼 보입니다. –
'obj/tomashell.o'를 만든 명령을 보여 주면, 그 소스 파일을 컴파일 할 때'-c' 플래그를 잊었을 가능성이 있습니다. – nos
@ Carl Norum : Spot on. 감사합니다. – Hubro