Warm tip: This article is reproduced from serverfault.com, please click

ghc-运行Haskell代码时,'gcc.exe'在阶段'Assembler'中失败

(ghc - 'gcc.exe' failed in phase 'Assembler' while running Haskell code)

发布于 2020-11-28 16:14:29

我有以下Haskell代码,该代码仅显示两个数字的和,差,乘积和商,以及从1到10的数字范围和字母。

main = do

    let a = 5
    let b = 10
    
    putStrLn "The addition of the two numbers is: "
    print(a + b);
    
    putStrLn "The subtraction of the two numbers is: "
    print(a - b);
    
    putStrLn "The multiplication of the two numbers is: "
    print(a * b);
    
    putStrLn "The division of the two numbers is: "
    print(a * b);
    
    print [1..10]
    print ['a'..'z']

我在一个在线编译器上运行了它,它似乎可以运行,但是当我将其粘贴到记事本上并通过终端运行时,它显示了错误:

Fatal error: can't create basicOperators.o: No such file or directory
`gcc.exe' failed in phase `Assembler'. (Exit code: 1)

这很有趣,因为我已经在计算机上安装了GHC,并且几天前Haskell编译器工作正常,但现在它停止了工作。我仍然是Haskell的初学者,我需要了解如何避免出现此错误。如果有人有想法,我将不胜感激。

Questioner
anonymous
Viewed
0
Ari Fordsham 2020-11-29 06:34:56

作为@n。“代词” m评论说,GHC写入此文件夹似乎有问题。尝试使用其他文件夹,例如,创建C:\Temp,复制代码并从此处进行编译。