FPC使用AVL_TREE

时间:2012-03-30 18:15:52

标签: pascal freepascal

我正在使用Ubuntu 11.04和Free Pascal Compiler版本2.4.0-2ubuntu3.1 [2011/06/17] for x86_64版权所有(c)1993-2009 by Florian Klaempfl

当我尝试编译此代码时:

program test;
uses AVL_Tree;
const N =  10;
type Number = ^Integer;

var all : TAVLTree;
actual :TAVLTreeNode;
a,i :Integer;
t : array[1..N] of Integer;
x :Number;

function compare(a,b:Pointer):LongInt;
begin
  compare := Number(a)^ - Number(b)^;
end;

begin
randomize;
for i := 1 to N do
  t[i] := i;

all := TAVLTree.Create(@compare);
for i := N downto 1 do
begin
  a:=1+random(i);
  new(x);
  x^:=t[a];
  all.add(x);
  t[a]:=t[i];
end;

actual := all.findLowest;
while actual <> nil do
begin
    Writeln(Number(actual.data)^);
    dispose(Number(actual.data));
    actual := all.FindSuccessor(actual);
end;

all.Free;
end.
它给了我:

Compiling avl.pas
Fatal: Can't find unit AVL_Tree used by test
Fatal: Compilation aborted 
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source     file to be compiled)

我不知道发生了什么..在我的学校,这段代码工作正常..任何想法我该怎么办?

0 个答案:

没有答案