我的com为什么编译不通过?
我写了一个简单的com,代码如下:
unit Unit1;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, ActiveX, Classes, ComObj;
type
ICalculator=interface
['{46DA26FE-95A7-41A5-9026-C73DEDC12100}']
function Add(x,y:Integer):Integer;safecall;
function Mult(x,y:Integer):Integer;safecall;
end;
type
TCalculator = class(TComObject,ICalculator)
protected
function Add(x,y:Integer):Integer;safecall;
function Mult(x,y:Integer):Integer;safecall;
end;
const
Class_Calculator: TGUID = '{ADEB22B8-86FA-4AAD-9737-881888DCA7C8}';
implementation
uses ComServ;
function Add(x,y:Integer):Integer;safecall;
begin
Result:=x+y;
end;
function Mult(x,y:Integer):Integer;safecall;
begin
Result:=x*y;
end;
initialization
TComObjectFactory.Create(ComServer, TCalculator, Class_Calculator,
'Calculator', '', ciMultiInstance, tmApartment);
end.
但是一编译就有如下错误:
[Error] Unit1.pas(20): Unsatisfied forward or external declaration: 'TCalculator.Add'
[Error] Unit1.pas(21): Unsatisfied forward or external declaration: 'TCalculator.Mult'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
怎么会Unsatisfied呢,哪位高手告诉我一下