【发布时间】:2014-09-21 00:53:11
【问题描述】:
我在 Windows 8.1 上使用 Free Pascal 2.6.4 32 位。我想使用 TFileStream 来复制文件。
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 的示例代码没有“uses”子句。是否需要在命令行中设置或包含在程序中才能将 TFileStream 与 Free Pascal 一起使用?
【问题讨论】:
-
@MitchWheat 我认为一个更好的问题是你为什么关心其他人使用什么编程语言。让我想起了当有人拿出黑莓手机时感到头晕的 iPhone 用户。
-
@MitchWheat 很高兴你能告诉我们流行的语言是什么,这样我们就不必去谷歌了。
-
那么,你为什么要使用 Pascal?
-
@MitchWheat 主要是怀旧,因为我已经足够大,可以在 DOS 上涉足 Turbo Pascal,但也因为它不流行,因为我喜欢不流行或不受欢迎的东西,也因为它可以做大多数现代语言做不到的事情——在三个主要的操作系统平台上生成可执行文件。
-
@Scooter
TFileStream存在于Classes单元中,因此您的问题的答案是:在您的程序中使用Classes单元(在uses部分中)。 @MitchWheat 产品的质量通常不取决于编程语言,而是取决于程序员的技能。