gpt4 book ai didi

c - 我的交叉编译器出了什么问题?

转载 作者:行者123 更新时间:2023-11-30 17:31:16 24 4
gpt4 key购买 nike

我正在尝试编译一个基本程序,我可以在我的 Mac 上进行交叉编译。我运行的是 Mac OS X Mavericks。我的交叉编译器是arm-elf-gcc-4.7.3。我编写了一个简单的测试程序,如下所示:

int main()
{
;
return 0;
}

当我运行/opt/local/bin/arm-elf-gcc-4.7.3 -o test test.c 时,我收到这些错误。

test.c:4:Unknown pseudo-op: .global
test.c:4:Rest of line ignored. 1st junk character valued 109 (m).
test.c:5:Unknown pseudo-op: .type
test.c:5:Rest of line ignored. 1st junk character valued 109 (m).
test.c:7:Junk character 64 (@).
test.c:7:Rest of line ignored. 1st junk character valued 32 ( ).
test.c:8:Junk character 64 (@).
test.c:8:Rest of line ignored. 1st junk character valued 32 ( ).
test.c:9:Junk character 64 (@).
test.c:9:Rest of line ignored. 1st junk character valued 32 ( ).
test.c:10:invalid char '[' beginning operand 2 `[sp'
test.c:11:too many memory references for `add'
test.c:12:expecting operand after ','; got nothing
test.c:13:too many memory references for `mov'
test.c:14:too many memory references for `add'
test.c:15:no such instruction: `ldmfd sp!, {fp}'
test.c:16:no such instruction: `bx lr'
test.c:17:Unknown pseudo-op: .size

我的交叉编译器出了什么问题?

最佳答案

编译器使用了错误的汇编器。我必须用 -B/opt/local/arm-elf- 指定前缀

关于c - 我的交叉编译器出了什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24714228/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com