ARM GCC编译错误(Windows 7)

时间:2013-04-09 02:43:47

标签: gcc arm cross-compiling gnu

这是我输入的命令及其吐出的内容:不幸的是,谷歌没有太多帮助,但我已经尝试了几件事(来自我非常初学的知识)并且我无法解决它。

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返回版本信息,因此路径正确

1 个答案:

答案 0 :(得分:0)

您是在为运行Linux的ARM7或ARM9或ARM9开发? 每个都需要不同的工具链。

好像你正在为ARM7开发(查看编译器可执行文件名),如果没有,那么你可能使用了错误的编译器。

看起来问题是您没有正确设置编译器工具链,需要正确安装并设置正确的路径。

我有一些设置arm YAGARTO(arm-gcc的特定发行版)的说明: (http://www.electronicsfaq.com/2012/11/blinky-and-printf-on-netduino-using.html

我使用netduino板上有一个ARM7。