题
我已经通过预生成的安装程序安装v6.8.2 Haskell中。
当试图编译与GHC此示例文件
module Main where
import Text.ParserCombinators.Parsec
import System.Environment
main :: IO ()
main = do args <- getArgs
putStrLn ("Hello")
我得到以下错误:
D:\src\Haskell>ghc -o read read.hs
ghc -o read read.hs
read.o(.text+0x1b5):fake: undefined reference to `__stginit_parseczm2zi1zi0zi0_TextziParserCombinatorsziParsec_'
collect2: ld returned 1 exit status
我已经通过小集团安装秒差距。
有没有人有任何想法的,什么是错的?
解决方案
尝试ghc --make -o read read.hs
。 GHC将接头依赖性照顾。
其他提示
我会拿出一个别的办法,使这项工作。
ghc -package parsec -o read read.hs
从GHC文档
-package P
This option causes the installed package P to be exposed. The package P can be
specified in full with its version number (e.g. network-1.0) or the version number
can be omitted if there is only one version of the package installed. If there are
multiple versions of P installed, then all other versions will become hidden.
The -package P option also causes package P to be linked into the resulting
executable or shared object. Whether a packages' library is linked statically or
dynamically is controlled by the flag pair -static/-dynamic.
见 http://www.haskell.org/ GHC /文档/最新/ HTML / users_guide / packages.html中
不隶属于 StackOverflow