我正在尝试在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时,我发现
FormTarget(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 for Win64中进行编译?
我也找不到cfree api的来源。
谢谢
最佳答案
我的经验是C4.5无法在Cygwin中进行编译,因为Cygwin不具备Linux中的完整库。因此,我在Windows计算机中将Ubuntu安装为虚拟OS。然后,我可以成功编译。