简体   繁体   中英

Haskell - Issue Compiling in GHC

I'm very new to Haskell, and I've recently installed the platform with GHC. I decided to test it out by compiling a simple Hello world program: main = putStrLn "Hello, world"

Now, when I go into the command line (Windows 7), find the proper directory, and type in ghc hello.hs , it comes back with the following message: "[1 of 1] Compiling Main ( hello.hs, hello.o )". I understand that once it's done compiling, it should follow with "Linking hello.exe ...", but that never comes, and no .exe is produced.

Basically, is there any discernible reason why this would be happening? Is there a problem with the code, is there something I don't know about, or should I just try re-installing the Haskell Platform?

Thank you.

我得到ghc通过从文件的开头删除模块声明将我的程序链接到可执行文件。

Has it produced an a.exe or a.out.exe or a.out file instead? If not, then maybe you can just link it yourself? ld -o hello.exe hello.o or whatever the link command is on your platform.

I would use the --make option, as in ghc --make hello.hs . (You can actually leave out the file extension if you like.) This will automatically figure out what needs to be done, which packages if any need to be linked in, and generally do everything you'd expect.

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