Hello Fellow Lazarus programmers,
I'm trying to compile a fairly complicated Lazarus project which I converted
from Delphi 7 Second Edition.
The attached txt file (3KB) contains the Lazarus compiler message errors and
the relevant code from the unit "MyIniFiles.pas"
NB - the file "MyIniFiles.pas" was created by copying the Borland Delphi 5
file "IniFiles.pas" and adding some procedures etc etc to it and resaving it
as MyIniFiles.pas (note: that was years ago!). The purpose of it is to
create & read & write .ini files (e.g. same as has been used in Micro$oft
Windowz).
NB(2) - I hope that the attachment is permitted by this group (e.g. not
against the rules). It is a plain text file.
Regards,
PEW
from Hobart, Tasmania, Australia
--
Fond Regards,
Peter Eric (aka 'pew') WILLIAMS
My free website is:
http://pewtas.googlepages.com (or) http://tinyurl.com/yuyejs
(please visit my free website and let me know what you think about it.)
Messages:
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Warning: You are using the obsolete switch -OG
Free Pascal Compiler version 2.2.0 [2008/04/01] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling frog.lpr
Compiling MainUnit.pas
Compiling MyIniFiles.pas
MyIniFiles.pas(309,52) Error: Identifier not found "GetPrivateProfileString"
MyIniFiles.pas(327,35) Error: Identifier not found "WritePrivateProfileString"
MyIniFiles.pas(329,44) Error: Identifier not found "SIniFileWriteError"
MyIniFiles.pas(379,33) Error: Identifier not found "GetPrivateProfileString"
MyIniFiles.pas(442,33) Error: Identifier not found "GetPrivateProfileString"
MyIniFiles.pas(495,35) Error: Identifier not found "WritePrivateProfileString"
MyIniFiles.pas(497,44) Error: Identifier not found "SIniFileWriteError"
MyIniFiles.pas(504,28) Error: Identifier not found "WritePrivateProfileString"
MyIniFiles.pas(505,22) Error: Illegal expression
MyIniFiles.pas(510,28) Error: Identifier not found "WritePrivateProfileString"
MyIniFiles.pas(510,61) Error: Illegal expression
MyIniFiles.pas(736) Fatal: There were 11 errors compiling module, stopping
From the pascal file "MyIniFiles.pas"
{ TMyIniFile }
function TMyIniFile.ReadString(const Section, Ident, Default: string): string;
var
Buffer: array[0..2047] of Char;
begin
SetString(Result, Buffer, GetPrivateProfileString(PChar(Section),
PChar(Ident), PChar(Default), Buffer, SizeOf(Buffer), PChar(FFileName)));
end;
// [ALVAROGP] PROCEDURE REWRITTEN BELOW TO AVOID WARNINGS
{
procedure TMyIniFile.WriteString(const Section, Ident, Value: string);
begin
if not WritePrivateProfileString(PChar(Section), PChar(Ident),
PChar(Value), PChar(FFileName)) then
raise Exception.CreateResFmt(@SIniFileWriteError, [FileName]);
end;
}
procedure TMyIniFile.WriteString(const Section, Ident, Value: string);
var
errorMsg: string;
begin
if not WritePrivateProfileString(PChar(Section), PChar(Ident),
PChar(Value), PChar(FFileName)) then begin
errorMsg := Format(SIniFileWriteError,[FileName]);
raise Exception.Create(errorMsg);
end;
end;
// [ALVAROGP] PROCEDURE REWRITTEN BELOW TO AVOID WARNINGS
{
procedure TMyIniFile.ReadSections(Strings: TStrings);
const
BufSize = 16384;
var
Buffer, P: PChar;
begin
GetMem(Buffer, BufSize);
try
Strings.BeginUpdate;
try
Strings.Clear;
if GetPrivateProfileString(nil, nil, nil, Buffer, BufSize,
PChar(FFileName)) <> 0 then
begin
P := Buffer;
while P^ <> #0 do
begin
Strings.Add(P);
Inc(P, StrLen(P) + 1);
end;
end;
finally
Strings.EndUpdate;
end;
finally
FreeMem(Buffer, BufSize);
end;
end;
}
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus