2
我寫了下面的文件temp.hs:與在data.set哈斯克爾程序犯規編譯
import qualified Data.Set
import System.Environment
main :: IO()
main = do
args <- getArgs
let fname = head args
print (fname)
它加載在ghci中沒有錯誤:
$ ghci
GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :load temp.hs
[1 of 1] Compiling Main (temp.hs, interpreted)
Ok, modules loaded: Main.
*Main>
當我嘗試編譯它,我得到以下錯誤:
$ ghc temp.hs -o temp
Undefined symbols:
"___stginit_containerszm0zi3zi0zi0_DataziSet_", referenced from:
___stginit_Main_ in temp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
如果我把導入Data.Set出來,它編譯好。
版本信息:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3
$ gcc --ver
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc_40/gcc_40-5494~112/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-arch=apple --with-tune=generic --host=i686-apple-darwin10 --target=i686-apple-darwin10
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5494)
此行爲不是特定於Mac,所以刪除'osx'和'mac'標籤和/或更改標題可能是一個好主意,因爲該問題可能對其他平臺上的用戶有用。 – 2010-11-10 20:42:10
@ Travis Brown:謝謝!我刪除了標籤並更改了標題。 – highBandWidth 2010-11-10 20:45:20