![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Несколько модулей в одном проекте.
Danila_master © (2007-02-26 17:05:00)Помогите разобраться, где ошибка.
Есть основной модуль:
unit CC;
interface
uses
SysUtils, Classes, AC;
type
TAoI = array of integer;
calcCenter = class
public
constructor Create;
destructor Destroy; override;
procedure calculate(size: TAoI);
private
contour: ActiveContour;
end;
implementation
constructor calcCenter.Create;
begin
...
end;
destructor calcCenter.Destroy;
begin
...
end;
procedure calcCenter.calculate(size: TAoI);
var
size1: TAoI;
begin
SetLength(size1, 2);
size1[0] := 512;
size1[1] := 512;
contour.setSize(size1);
end;
end.
и модуль с классом:
unit AC;
interface
uses
SysUtils, Classes;
type
TAoI = array of integer;
ActiveContour = class
public
constructor Create;
destructor Destroy; override;
procedure setSize(size: TAoI);
private
_size: array of Integer;
end;
implementation
constructor ActiveContour.Create;
begin
...
end;
destructor ActiveContour.Destroy;
begin
...
end;
procedure ActiveContour.setSize(size: TAoI);
begin
_size[0] := size[0];
_size[1] := size[1];
end;
и вадает ошибку:
"CC.pas(159): E2010 Incompatible types: 'AC.TAoI' and 'CC.TAoI'"
Никак не могу понять, где ошибка?
trubin (2007-02-26 19:54:00) [1]Можно явно указывать имена модулей: AC.TAoI и СC.TAoI
Аноним (2007-02-26 17:48:00) [2]
> Danila_master ©
ты не понял
Модуль Types уже существует, в VCL
а в нем уже есть тип
TIntegerDynArray = array of Integer;
можно подключить его в Uses и использовать TIntegerDynArray вместо TAoI
Danila_master (2007-02-26 17:19:00) [3]Сделал как советовали, создал новый модуль:
unit Types;
interface
type
TAoI = array of integer;
implementation
end.
во всех модулях добавил:
uses
SysUtils, Classes, AC, EF, Types;
Теперь выдает новые ошибки:
[Pascal Error] AC.pas(36): E2003 Undeclared identifier: 'TAoI'
[Pascal Error] AC.pas(228): E2008 Incompatible types
ну и так далее. Что я опять сделал не так?
Аноним (2007-02-26 17:08:00) [4]Ты вообще зачем в двух модулях одинаковые типы объявил?
TAoI = array of integer;
оставь только один, и будет счастье
Darvin (2007-02-26 17:08:00) [5]unit Types
...
TIntegerDynArray = array of Integer;