gpt4 book ai didi

haskell - 为什么 Haskell ghc 不起作用,而 runghc 却很好用?

转载 作者:行者123 更新时间:2023-12-04 16:42:39 26 4
gpt4 key购买 nike

一个代码来自 runghc,但我无法使用 ghc 命令编译相同的代码。为什么?

下面是我的最小代码和环境: https://gist.github.com/1588756

效果很好:

$ runghc cat.hs

无法编译:

$ ghc cat.hs -o cat

Macbook air, max os x 雪豹

最佳答案

您的粘贴中显示的 .cs 扩展名是错误的;1 将文件重命名为 cat.hs 它将正常工作。

此错误信息:

ld: warning: ignoring file cat.cs, file was built for unsupported file format
which is not the architecture being linked (i386)

当你传递一个 GHC 不知道如何处理的文件时发生;它只是将它直接传递给链接器,然后链接器将其忽略,因为 也不知道。 :)

1 至少在 GHC 获得 C# 支持之前...

关于haskell - 为什么 Haskell ghc 不起作用,而 runghc 却很好用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8804955/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com