Sono un po 'un principiante in Haskell e sto provando stack per creare un'applicazione.Errore GHC Linker (stack)
Tuttavia, stack build
mi dà errori di linker quando eseguito:
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/sim-exe/sim-exe ...
[...]/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/libHSsim-0.1.0.0-EmdGqYS9bXF9VefempSPEG.a(Lib.o):(.text+0x98f5): undefined reference to `simzuEmdGqYS9bXF9VefempSPEG_Linter_lint_info'
[...]/.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/libHSsim-0.1.0.0-EmdGqYS9bXF9VefempSPEG.a(Lib.o):(.data+0x5f0): undefined reference to `simzuEmdGqYS9bXF9VefempSPEG_Linter_lint_closure'
collect2: error: ld returned 1 exit status
Guardando le etichette mi dice che è legato ad una chiusura in questa funzione:
lint :: String -> [LintError]
lint source = let
handleParseError :: ParseError -> [LintError]
handleParseError e = [LintError (fromSourcePos $ errorPos e) $ format e]
in
case parseSim source of
(Left error) -> handleParseError error
(Right prog) -> lintProgram prog
Ma non c'è davvero una chiusura a Là? Se si sostituisce la realizzazione di lint
con
lint _ = []
si compila bene.
Posso eseguire stack ghci
e giocare con l'intera implementazione lint
bene. Perché non riesce a collegarsi?
Probabilmente il modulo non è incluso nel file cabal? – Yuras
@Yuras sì, era così ... Ho aggiunto il modulo sotto 'exposed-modules' e ora funziona - semplicemente non sapevo di doverlo fare. Grazie – DeX3
@ DeX Potresti scriverlo come risposta e accettarlo? –