更新已解决
我更新到Haskell Platform 2011.2.0.1和GHC 7.0.3,现在它可以工作!!
我有以下名为“webscrap2.hs”的haskell文件。我可以执行“runghc webscrap2.hs”,它工作正常。但是当我编译文件时出现错误。
webscrap2.hs
import Text.HTML.TagSoup
import Network.Curl (curlGetString, URLString)
main :: IO ()
main = do html <- openURL "https://github.com/languages/Haskell/created"
let links = linkify html
print links
openURL :: URLString -> IO String
openURL target = fmap snd $ curlGetString target []
linkify :: String -> [String]
linkify l = [x | TagOpen "a" atts <- parseTags l, (_,x) <- atts]
ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3
ghc -o webscrap2 webscrap2.hs
webscrap2.o: In function `r17I_info':
(.text+0x1fe): undefined reference to `tagsoupzm0zi12_TextziHTMLziTagSoupziParser_parseTags_closure'
webscrap2.o: In function `r17I_info':
(.text+0x204): undefined reference to `tagsoupzm0zi12_TextziStringLike_zdfStringLikeZMZN_closure'
webscrap2.o: In function `s1eb_info':
(.text+0x6fc): undefined reference to `curlzm1zi3zi7_NetworkziCurl_curlGetString_closure'
webscrap2.o: In function `s1ed_info':
(.text+0x927): undefined reference to `__stginit_curlzm1zi3zi7_NetworkziCurl_'
webscrap2.o: In function `s1ed_info':
(.text+0x933): undefined reference to `__stginit_tagsoupzm0zi12_TextziHTMLziTagSoup_'
webscrap2.o: In function `r17I_srt':
(.data+0x90): undefined reference to `tagsoupzm0zi12_TextziHTMLziTagSoupziParser_parseTags_closure'
webscrap2.o: In function `r17I_srt':
(.data+0x98): undefined reference to `tagsoupzm0zi12_TextziStringLike_zdfStringLikeZMZN_closure'
webscrap2.o: In function `s1ed_srt':
(.data+0xf8): undefined reference to `curlzm1zi3zi7_NetworkziCurl_curlGetString_closure'
collect2: ld returned 1 exit status
指出问题可能是什么?
答案 0 :(得分:0)
您可能想尝试更新GHC和正在使用的软件包,看看是否有帮助。
答案 1 :(得分:0)
假设您已经运行cabal install tagsoup
,那么这只是--make
的一个小问题:
ghc -o webscrap2 webscrap2.hs --make