此错误是什么意思:未定义的符号:THREADVARLIST_STRINGS

发布于 2024-11-26 13:32:31 字数 937 浏览 3 评论 0原文

我刚刚开始学习 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌无敌 2024-12-03 13:32:31

不要命名您的程序字符串。有一个具有该名称的预编译单元。

一般来说,意味着您创建了一个主程序,但没有链接正确的 RTL。

可能的原因:

  • 版本冲突、(编译器<>RTL)
  • 由于手动链接(尝试从C访问Pascal?)
  • 尝试使用不支持某些语言功能的嵌入式RTL而发生的错误。
  • 你的情况)一些命名冲突。但这通常很少见,并且通常会被编译器捕获。因此,这种体验可能值得在 FPC bugtracker 中作为 bug 归档

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:

  • Version conflicts, (compiler<>RTL)
  • mistakes made by manual linking (trying to access Pascal from C?)
  • trying to use an embedded RTL that doesn't support certain language features.
  • (your case) some naming conflict. But this is usually rare, and usually trapped by the compiler. Therefore, this experience might be worth filing as bug in the FPC bugtracker
冰之心 2024-12-03 13:32:31

更改:

程序字符串;

至:对

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文