链接器错误:未定义对_fini的引用 [英] Linker error: undefined reference to `_fini'
问题描述
我刚开始使用lpcXpresso进行嵌入式系统开发.它使用经过修改的Eclise作为其IDE,以及一个MCU C编译器和MCU链接器.
I am just getting strted with lpcXpresso for embedded system development. It uses a modifed Eclise as its IDE and an MCU C compiler and MCU linker.
我导入了一些新代码,并且出现了一些链接器错误,很快我就将其解决了.但是最后一个让我难过:
I imported some eisting code and had a few linker errors, which I soon sorted out. But the final one has me stumped:
undefined reference to `_fini'
我希望这意味着我的一些代码调用了一个名为fini()
的函数-对吗?
I would expect that that means that some of my code calls a function called fini()
- right?
除了我没有一个(诚然有一个InitialzeTracingSubsystem()
).而且我不认为链接程序会截断该名称,因为它先前曾抱怨_getimeofday
.
Except that I don't have one (admiteddly there is an InitialzeTracingSubsystem()
). And I don't believe that the linker is truncating the name because it earlier complained of _getimeofday
.
知道我在做什么错吗?
推荐答案
您没有显示命令行.我猜想您直接使用了ld
(链接器).
You didn't show your command line. I am guessing you've used ld
(the linker) directly.
不要那样做.相反,总是使用编译器驱动程序进行链接.
Don't do that. Instead, always use the compiler driver to do the linking.
_init
和_fini
通常是libc
或随附的C运行时启动文件(crt0.o
,crtend.o
等)的一部分.
The _init
and _fini
are usually part of libc
, or the C runtime startup files (crt0.o
, crtend.o
, etc.) that come with it.
编译器驱动程序将进行必要的魔术操作以链接它们.链接器则不会.
The compiler driver will do the magic necessary to link them in. The linker would not.
这篇关于链接器错误:未定义对_fini的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!