2014-09-21 39 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.