Linux 64 비트 시스템에서 C로 hello world 프로그램을 컴파일하려고합니다. ARM 응용 프로그램을 ARM 프로세서에로드하기 위해 ARM 크로스 컴파일러를 사용하고 있습니다. 내가 수행하여 컴파일 할 때arm-none-eabi-gcc로 hello world 프로그램 C 컴파일시 오류가 발생했습니다.
/home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function
exit': exit.c:(.text.exit+0x2c): undefined reference to
_exit' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function_sbrk_r': sbrkr.c:(.text._sbrk_r+0x18): undefined reference to
_sbrk' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function_write_r': writer.c:(.text._write_r+0x20): undefined reference to
_write' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function_close_r': closer.c:(.text._close_r+0x18): undefined reference to
_close' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function_fstat_r': fstatr.c:(.text._fstat_r+0x1c): undefined reference to
_fstat' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function_isatty_r': isattyr.c:(.text._isatty_r+0x18): undefined reference to
_isatty' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function_lseek_r': lseekr.c:(.text._lseek_r+0x20): undefined reference to
_lseek' /home/dico/gcc-arm-none-eabi-4_7-2013q3/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function_read_r': readr.c:(.text._read_r+0x20): undefined reference to
_read' collect2: error: ld returned 1 exit status
: arm-none-eabi-gcc -o hello hello.c
를 사용하여 코드를 컴파일 할 때 그러나, 나는 오류의 시리즈를 얻을 arm-none-eabi-gcc -c hello.c
를, 그것은 컴파일러가 잘 실행 하더군요 오브젝트 코드 hello.o
을 만듭니다.
누군가 내 컴파일이 왜 그러한 오류를 반환하는지 알려주시겠습니까?
UPDATE 나는 C 런타임 라이브러리가 컴파일에 포함되지 않는다는 것을 지금 실현
. 컴파일러에 포함해야 할 옵션이나 printf와 같은 표준 함수를 사용할 수 있도록 라이브러리를 링크하는 방법을 아는 사람이 있습니까?
보기 http://embdev.net/topic/129753 –
이것은 도움이 될 수 있습니다. http://stackoverflow.com/questions/13235748/linker-error-on-ac-project-using-eclipse –
libc 로우 레벨 함수. 그것은 플랫폼에 의존하기 때문에 arm-none-eabi-gcc 툴체인은 그것을 가지지 않을 것입니다. 일반적으로 칩 제조업체가 제공합니다. 대상 플랫폼이 무엇입니까? ** ** libc 함수 사용을 중단하면 (printf, malloc, open 등) 프로그램을 컴파일 할 수 있습니다. –