首页 > 解决方案 > 为什么这里找不到这个简单的 showMessage 对话框标识符

问题描述

我在这里使用以下简单代码:

program LazMessage;
uses 
  Dialogs;
begin
  ShowMessage('This is a message from Lazarus');
end.

但是,它给出了以下错误:

 fpc gui_showmsg.pas 
Free Pascal Compiler version 3.0.0+dfsg-11+deb9u1 [2017/06/10] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling gui_showmsg.pas
gui_showmsg.pas(6,3) Error: Identifier not found "ShowMessage"
gui_showmsg.pas(9) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode

添加{$mode delphi}{$mode objfpc}没有任何区别。

问题出在哪里,如何解决?

标签: user-interfacefreepascal

解决方案


不幸的是,ShowMessage适用于 Lazarus 而不是 FreePascal。所以,你不能在 FreePascal 中使用它。


推荐阅读