Вниз
Скачать: CL | DM;

Несколько модулей в одном проекте.   Найти похожие ветки 

 
Danila_master ©   (2007-02-26 17:05) [0]

Помогите разобраться, где ошибка.
Есть основной модуль:
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""
Никак не могу понять, где ошибка?


 
Аноним   (2007-02-26 17:08) [1]

Ты вообще зачем в двух модулях одинаковые типы объявил?
TAoI = array of integer;

оставь только один, и будет счастье


 
Darvin ©   (2007-02-26 17:08) [2]

unit Types
 ...
 TIntegerDynArray = array of Integer;


 
Danila_master ©   (2007-02-26 17:19) [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:48) [4]


> Danila_master ©


ты не понял
Модуль Types уже существует, в VCL
а в нем уже есть тип

TIntegerDynArray = array of Integer;

можно подключить его в Uses и использовать TIntegerDynArray  вместо TAoI


 
trubin ©   (2007-02-26 19:54) [5]

Можно явно указывать имена модулей: AC.TAoI и СC.TAoI



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.026 c
1-1169444577
lenka_per
2007-01-22 08:42
2007.03.18
ячейка из excel больше 255 символов


2-1172146562
VitAngel
2007-02-22 15:16
2007.03.18
Памагите разобраться в ошибке!


15-1171890622
CCili
2007-02-19 16:10
2007.03.18
Кто-нить играл в World of Warcraft


2-1172150387
Lonix
2007-02-22 16:19
2007.03.18
Помощь с сеткой на форме


2-1172006483
Comp
2007-02-21 00:21
2007.03.18
Маленький простой вопрос - прокрутка формы




   Наверх