I'm looking to generate a simple command line program.
The Lazarus.lpi file is located in the following directory:
D:\Install\Programs\Lazarus\ide\
Hench, I changed it from the default, .\, to that; during the 2nd installation.
In the first installation, Unit1 couldn't be found after following the direction here:
http://forum.lazarus.freepascal.org/index.php?topic=24708.0I've gone to Tools → Options → Environment → File → Lazarus directory (default for all project)
I've changed it from:
D:\Install\Programs\Lazarus\
To:
D:\Install\Programs\Lazarus\
It now gives the error: project1.lpr(2,6) Fatal: Cannot find unit1 used by project1 of the Project Inspector.
(http://i.imgur.com/ysgZ5zHm.jpg)I guess this is major progress than, and probably warrants a new thread, but I'll stick on this thread for now.
Project
-> select Project Inspector
-> click + Add
-> in New Requirement select LazUtils from "Package Name"
-> Create New Requirement
Still getting the same error after following these steps.
I got the program to work by doing away with Unit1 completely. I'm afraid there's some sort of memory leakage, since I had to do away with memo1.clear et al.
program project1;
{procedure TStringList = class(TStrings);}
Type
videoNamesArray = Array of String; {dynamic array; size initially set to 0}
Var
arr : videoNamesArray;
totalLines: Integer; {why can't I define this locally, instead of globally?}
s: String;
{this function will count how many lines are in the textFile
and will assign that as the length of the dynamic array: videoNamesArray}
function lineCount(fileName: String): Integer;
Var f: textfile;
{totalLines: Integer;} {why can't I define this locally, instead of globally?}
begin
assignFile(f, filename);
reset(f); {open for reading}
totalLines:=0;
While NOT eof(f) do begin
readln(f);
inc(totalLines);
end;
closeFile(f);
lineCount := totalLines;
end;
{function transferToArray (videoNamesArray: a; fileName: String) }
begin
{writeln ('Hello, world.');}
Str(lineCount('C:\Program Files (x86)\ReNamer\Scripts\filenames.txt'), s);
writeln('Total lines in file: ', s);
readln
end.