此错误是什么意思:未定义的符号:THREADVARLIST_STRINGS
我刚刚开始学习 Free Pascal,我编写了这个相当基本的程序来练习数组。我收到两个错误:
Strings.lpr(32,1) 错误:未定义符号:THREADVARLIST_STRINGS
Strings.lpr(32,1) 错误:未定义符号:STRINGS_STRPAS$PCHAR$$SHORTSTRING
Strings.lpr(32,1) 致命:编译模块时出现 2 个错误,正在停止
代码如下:
program Strings;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils
{ you can add units after this };
{$R *.res}
var
Marks : array [1..10] of Integer;
index : Integer;
begin
for index:= 0 to 10 do
begin
write('Enter mark of student ',index,': ');
readln(marks[index]);
end;
for index := 0 to 10 do
begin
write('Student No. ',index,' Marks: ',marks[index],' ');
if marks[index]>65 then writeln('PASS')
else writeln('FAIL');
end;
writeln('Press any key to continue.');
readln;
end. {line 32}
I just started learning Free Pascal and I wrote this fairly basic program to practise arrays. I get two errors:
Strings.lpr(32,1) Error: Undefined symbol: THREADVARLIST_STRINGS
Strings.lpr(32,1) Error: Undefined symbol: STRINGS_STRPAS$PCHAR$$SHORTSTRING
Strings.lpr(32,1) Fatal: There were 2 errors compiling module, stopping
The code is as follows:
program Strings;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils
{ you can add units after this };
{$R *.res}
var
Marks : array [1..10] of Integer;
index : Integer;
begin
for index:= 0 to 10 do
begin
write('Enter mark of student ',index,': ');
readln(marks[index]);
end;
for index := 0 to 10 do
begin
write('Student No. ',index,' Marks: ',marks[index],' ');
if marks[index]>65 then writeln('PASS')
else writeln('FAIL');
end;
writeln('Press any key to continue.');
readln;
end. {line 32}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要命名您的程序字符串。有一个具有该名称的预编译单元。
一般来说,意味着您创建了一个主程序,但没有链接正确的 RTL。
可能的原因:
Don't name your program strings. There is a precompiled unit with that name.
In general means that you create a mainprogram but don't link a proper RTL.
Possible causes:
更改:
程序字符串;
至:对
testStrings 进行编程;
更正错误。字符串是保留字。
另外,你还有“按任意键”,然后是 readln。 readln 等待回车。类似于:
WriteLn('按任意键继续。');
重复
直到按下按键;
可能就是您正在寻找的。
Changing:
program Strings;
to:
program testStrings;
corrects the error. Strings is a reserved word.
Also, you also have "Press Any Key" followed by readln. readln waits for a carriage return. Something like:
WriteLn('Press any key to continue.');
repeat
until KeyPressed;
is probably what you're looking for.