2013-04-09 179 views
0

下面是我輸入的命令及其吐出的內容:不幸的是,谷歌並沒有太大的幫助,但我嘗試了幾件事(從我非常初學者的知識),我一直沒有能夠解決它。ARM GCC編譯錯誤(Windows 7)

C:\Users\Z\workspace\TEST\src>gcc main.c 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): In function `exit': 

exit.c:(.text.exit+0x2c): undefined reference to `_exit' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-sbrkr.o): In function `_sbrk_r': 

sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-writer.o): In function `_write_r': 

writer.c:(.text._write_r+0x20): undefined reference to `_write' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-closer.o): In function `_close_r': 

closer.c:(.text._close_r+0x18): undefined reference to `_close' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-fstatr.o): In function `_fstat_r': 

fstatr.c:(.text._fstat_r+0x1c): undefined reference to `_fstat' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-isattyr.o): In function ` 
_isatty_r': 

isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../arm-none-eabi/lib\libc.a(lib_a-lseekr.o): In function `_lseek_r': 

lseekr.c:(.text._lseek_r+0x20): undefined reference to `_lseek' 
c:/program files (x86)/gnu tools arm embedded/4.7 2013q1/bin/../lib/gcc/arm-none 
-eabi/4.7.3/../../../../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.exe: error: ld returned 1 exit status 

的main.c包含以下內容:

#include <stdio.h> 
#include <stdlib.h> 

int main(int argc, char *argv[]) { 
    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ 
    return EXIT_SUCCESS; 
} 

gcc -v回報版本信息,以便路徑是正確的

+0

那麼,你有圖書館的問題。看來你正在使用'newlib'編譯器。你正在爲** Linux **,** Android **,** iPhone **或**裸機**或**獨立式**環境編程?您的主機是** Window 7 **或者這是** Windows Phone **?對於'newlib',主板必須實現一些最基本的功能。你已經實現了這些,或者是被編譯爲* BeagleBoard *,* Raspberry Pi *等的編譯器。你從哪裏得到編譯器?請回答這些問題中的一部分以幫助下一個看到你的問題的人。 – 2013-04-09 03:49:03

回答

0

你開發ARM7或ARM9或ARM9上運行Linux? 對於其中的每一個,您都需要不同的工具鏈。

好像你正在爲ARM7開發(看編譯器的可執行文件名),如果沒有,那麼你可能會使用錯誤的編譯器。

這個問題似乎是你沒有正確設置編譯器工具鏈,它需要適當的路徑設置正確的安裝。

我有設定杆YAGARTO(針對ARM-GCC特定的分佈)某些指令的位置: (http://www.electronicsfaq.com/2012/11/blinky-and-printf-on-netduino-using.html

我用netduino板,其上有一個ARM7。