Haskell Parsec을 컴파일 오류
문제
사전 제작자 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
Cabal을 통해 Parsec을 설치했습니다.
무엇이 잘못되었는지에 대한 아이디어가 있습니까?
해결책
노력하다 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/docs/latest/html/users_guide/packages.html
제휴하지 않습니다 StackOverflow