FreePascal:将 SmallInt 转换为 ShortString?

FreePascal: convert SmallInt to ShortString?

我正在尝试调试一些代码。将调试消息打印到屏幕的函数需要一个短字符串,但我想以某种方式将一个 smallint 传递给它。这是我的代码:

dialogmsg('MapTile ' + ShortString( MyInteger ));

我在编译程序时收到此消息:

Error: Illegal type conversion: "SmallInt" to "ShortString"

我做错了什么?谢谢

您需要在 sysstrh.inc 中使用 IntToStr

dialogMsg('MapTile ' + IntToStr(MyInteger));