我正在尝试在C4.5
中为Cygwin
编译Win64
算法。我有错误
besttree.o:besttree.c:(.text+0x240): undefined reference to `cfree'
besttree.o:besttree.c:(.text+0x240): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `cfree'
当我查看besttree.c时,我在
中找到了cfreeFormTarget(Size)
/* ----------- */
ItemNo Size;
{
ItemNo i, *ClassFreq;
ClassNo c, Smallest, ClassesLeft=0;
ClassFreq = (ItemNo *) calloc(MaxClass+1, sizeof(ItemNo));
while ( ClassesLeft )
{
/* Find least common class of which there are some items */
Smallest = -1;
ForEach(c, 0, MaxClass)
{
if ( ClassFreq[c] &&
( Smallest < 0 || ClassFreq[c] < ClassFreq[Smallest] ) )
{
Smallest = c;
}
}
/* Allocate the no. of items of this class to use in the window */
TargetClassFreq[Smallest] = Min(ClassFreq[Smallest], Round(Size/ClassesLeft));
ClassFreq[Smallest] = 0;
Size -= TargetClassFreq[Smallest];
ClassesLeft--;
}
cfree(ClassFreq);
}
这次编译可能会出现什么问题?是因为在Cygwin中为Win64编译了吗? 我也找不到cfree api的来源。 感谢
答案 0 :(得分:0)
我的经验是C4.5无法在Cygwin中编译,因为Cygwin没有像Linux那样携带完整的库。所以我在我的Windows机器上安装Ubuntu作为虚拟操作系统。然后,我可以成功编译。