2014-09-21 40 views
1

我在Windows 8.1上使用Free Pascal 2.6.4 32位。我想使用TFileStream来复制文件。如何消除TFileStream上的Free Pascal'not recognized'编译错误?

program copy; 

procedure CopyFile (strFilename : string); 
var 
    SourceF, DestF : TFileStream; 
begin 
end; 
begin 
    writeln('starting '); 

end. 

编译器不能识别TFileStream的:

fpc copy_small.pas 
Free Pascal Compiler version 2.6.4 [2014/03/06] for i386 
Copyright (c) 1993-2014 by Florian Klaempfl and others 
Target OS: Win32 for i386 
Compiling copy_small.pas 
copy_small.pas(5,33) Error: Identifier not found "TFileStream" 
copy_small.pas(5,33) Error: Error in type definition 
copy_small.pas(12) Fatal: There were 2 errors compiling module, stopping 
Fatal: Compilation aborted 
Error: C:\FPC\2.6.4\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled) 

我使用TFileStream的没有在网络上找到的示例代码“使用”的条款。有什么需要在命令行中设置或包含在程序中以便使用TFileStream和Free Pascal?

+0

@MitchWheat我想一个更好的问题是,为什么你在乎别人用什么编程语言。让我想起iPhone的用户,当有人拔出黑莓时,他们会发出眩晕的声音。 – Scooter 2014-09-21 02:56:56

+0

你有没有听说过“马匹的课程”这个表达方式?帕斯卡是一种死去的语言,你可能还会学习COBOL。说实话,我不在乎你是否想浪费你的时间,而是学习一些将继续 – 2014-09-21 02:59:55

+0

@MitchWheat我们很高兴能告诉我们什么是流行语言,所以我们不必谷歌。 – Scooter 2014-09-21 03:24:55

回答

1

TFileStream生活在Classes单位,所以你的代码应该是

program copy; 

// To use any 'non-system' functionality add necessary units here 
uses 
    Classes; 

procedure CopyFile (strFilename : string); 
var 
    SourceF, DestF : TFileStream; 
begin 
end; 
begin 
    writeln('starting '); 

end.