Hello,
coming from C# I tried to play a little with FPC.
Having problems with packages and couldnt find much stuff around that explains a little details:
1. I created a new project as package.
2. I created a unit with a single type:
unit Unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
// the type TRandomNumber gets globally known
// since it is included somewhere (uses-statement)
TRandomNumber = integer;
implementation
end.
3. Set package to "Runtime" since I only wanna import the code into the project, not into UI.
4. Compiled package without any errors or messages -> named: "PackageTest".
5. Created another project.
6. Added my package to project within project-inspector.
7. Added package-name to uses-clause of my project (works without flaws).
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, PackageTest;
type
TForm1 = class(TForm)
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
var
chosenRandomNumber: TRandomNumber;
end.
But now I cant define type of "TRandomNumber", compiler says
unit1.pas(27,25) Error: Identifier not found "TRandomNumber"
.
Also with a second package I did before, I cant access anything from inside my packages.
What am I doing wrong?
Are there any paths I have to set additionaly? I thought importing my package within project-inspector is enough, also it seems to recognize my package by name, but not any of its members.