简体   繁体   中英

'gcc.exe' failed in phase 'Assembler' while running Haskell code

I have the following Haskell code which simply displays the sum, difference, product, and quotient of two numbers, along with the range of numbers from 1 to 10 and the letters.

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']

I ran it on an online compiler and it seemed to work, but when I pasted it on Notepad and ran it through Terminal, it showed the error:

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

This is interesting because I have GHC installed on my computer and the Haskell compiler was working just fine a few days ago, but now it stopped working. I am still a beginner at Haskell and I need a hand on how I can avoid getting this error. I will appreciate it if someone has an idea.

As @n. 'pronouns' m commented, GHC seems to have a problem writing to this folder. Try using a different folder, for example creating C:\Temp , copying over your code and compiling from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM