我有下面的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的初学者,我需要了解如何避免出现这个错误。如果有人有主意,我将不胜感激。
作为@n.'代词的评论,GHC似乎有一个问题写入这个文件夹。尝试使用不同的文件夹,例如创建C:Temp
、复制代码并从中编译。