У меня 2-я версия fpc
На простенькую программку при компоновке выдаёт ошибки
program fr;
{$mode objfpc}
{$H+}
uses SysUtils;
var H,L:Integer; S,D:string;
begin
H:=FileOpen(ParamStr(1),fmOpenRead+fmShareDenyNone);
if H>0 then try
SetLength(S,FileSeek(H,0,2));
FileSeek(H,0,0);
L:=FileRead(H,S[1],Length(S));
if L<>Length(S) then begin
WriteLn('Ошибка чтения.');
Halt(1);
end;
finally FileClose(H); end else begin
WriteLn('Не могу открыть файл.');
Halt(1);
end;
D:=S; // Чего-то делаем с файлом
H:=FileCreate(ChangeFileExt(ParamStr(1),'.dst'));
if H>0 then try
if FileWrite(H,D[1],Length(D)) <> Length(D)
then begin
WriteLn('Ошибка записи.');
Halt(1);
end;
finally FileClose(H); end else begin
WriteLn('Не могу создать файл.');
Halt(1);
end;
end.
Вот текст ош.:
Linking fr.exe
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s277.o)(.text+0x7f):sy
sutils.pp: undefined reference to `WINDOWS_CREATEFILE$crcD170D95E'
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s282.o)(.text+0x19):sy
sutils.pp: undefined reference to `WINDOWS_SETFILEPOINTER$LONGWORD$LONGINT$PLONG
$LONGWORD$$LONGWORD'
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s278.o)(.text+0x64):sy
sutils.pp: undefined reference to `WINDOWS_CREATEFILE$crcD170D95E'
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s323.o)(.text+0x2f):sy
sutils.pp: undefined reference to `WINDOWS_GETVERSIONEX$OSVERSIONINFO$$LONGBOOL'
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s323.o)(.text+0xa8):sy
sutils.pp: undefined reference to `WINDOWS_LOADLIBRARY$PCHAR$$LONGWORD'
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s323.o)(.text+0xc2):sy
sutils.pp: undefined reference to `WINDOWS_GETPROCADDRESS$LONGWORD$PCHAR$$POINTE
R'
C:\TOOLS\FPC\units\i386-win32\rtl\libpsysutils.a(sysutils0s315.o)(.text+0x5c):sy
sutils.pp: undefined reference to `WINDOWS_MAKELANGID$LONGINT$LONGINT$$LONGINT'
Error: Error while linking
Думаю, что пути в fpc.cfg нормальные:
-FuC:\TOOLS\FPC/units/$FPCTARGET/
-FuC:\TOOLS\FPC/units/$FPCTARGET/*
-FuC:\TOOLS\FPC/units/$FPCTARGET/rtl
Где я ошибся?