我正在尝试安装可执行文件以在Mac OS 10.8上的HLA中编译程序。尽管这些工具似乎在正确的位置并且可以正常工作,但是在尝试编译第一个程序时却遇到了以下错误

ld: warning: -macosx_version_min not specified, assuming 10.8
Undefined symbols for architecture i386:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
Error returned by ld = 256

HLA executalbe似乎会输出目标文件,但链接器中的某些内容似乎无法正常工作。我以前设法将其安装在其他计算机上,但是在大多数情况下,我会收到此错误。

有任何想法吗?

最佳答案

您可以通过使用“-main:_main”来告诉HLA将“_main”用作入口点。您可能还需要与libSystem.dylib链接,并摆脱一些链接器警告,以便整个命令为
hla -main:_main -l"macosx_version_min 10.9" -l"lSystem" -l"no_pie" source.hla

关于HLA(高级组件)安装和链接器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20053784/

10-11 22:39