Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.03.18;
Скачать: 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 вся ветка

Текущий архив: 2007.03.18;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.045 c
2-1172043399
dimas#
2007-02-21 10:36
2007.03.18
MDI форма


4-1162781388
Коля
2006-11-06 05:49
2007.03.18
SendTo в PopupMenu?


2-1172155883
\/ainu
2007-02-22 17:51
2007.03.18
Простая прога


2-1172582601
vigo_
2007-02-27 16:23
2007.03.18
Изменение данных файла


15-1171915643
ferr
2007-02-19 23:07
2007.03.18
Клиенты для форума.