重定位被截断以适合:R_X86_64_PC32对未定义的符号`cfree'

时间:2014-10-09 13:05:34

标签: c linux cygwin decision-tree

我正在尝试在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时,我在

中找到了cfree
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中为Win64编译了吗? 我也找不到cfree api的来源。 感谢

1 个答案:

答案 0 :(得分:0)

我的经验是C4.5无法在Cygwin中编译,因为Cygwin没有像Linux那样携带完整的库。所以我在我的Windows机器上安装Ubuntu作为虚拟操作系统。然后,我可以成功编译。