You need to specify the haskell libraries you're going to use, and also typically for FFI bindings you'll need get jhc to tell the c compiler which c library to link to, so to compile your example would be: jhc -p SDL test.hs -o test --optc='-lSDL' If you use another package as well say SDL-image then it would be: jhc -p SDL -p SDL-image test.hs -o test --optc='-lSDL' --optc='-lSDL_image' I also noticed a minor problem with the code, some kind of ambiguity with main, it wouldn't compile without stating the type of main, e.g: module Main where import Graphics.UI.SDL.Version main :: IO () main = return () ________________________________
Date: Sat, 7 Aug 2010 19:37:06 +0200 From: csaba.hruska@gmail.com To: jhc@haskell.org Subject: [jhc] jhc and sdl
Hi!
I've a problem with jhc 0.7.6. I've compiled and installed (jhc modded) sdl succesfully but for even this simple example code fails to compile:
import Graphics.UI.SDL.Version -- Graphics.UI.SDL is not exported main = return ()
here is the output:
bash-3.2$ jhc test.hs jhc test.hs jhc 0.7.6 (0.7.6-3) Finding Dependencies... Using Ho Cache: '/Users/hruskacsaba/.jhc/cache' Main [test.hs] Error: Module not found: Graphics.UI.SDL.Version
jhc knows about sdl: bash-3.2$ jhc --list-libraries - SDL-0.6.2 - xhtml-3000.2.0.1 - HUnit-1.2.2.1 - parsec-2.1.0.1 - applicative-1.0 - QuickCheck-1.2.0.0 - Diff-0.1.2 - haskell98-1.0 - base-1.0 - smallcheck-0.4 - containers-0.3.0.0 - pretty-1.0.1.1 - utility-ht-0.0.5.1 - html-1.0.1.2 - jhc-1.0 - flat-foreign-1.0 - safe-0.2
the hl file is placed in ~/lib/jhc bash-3.2$ ls -l ~/lib/jhc total 424 -rw-r--r-- 1 hruskacsaba staff 216003 Aug 7 18:14 SDL-0.6.2.hl
So, do you have any idea what's the problem?
Cheers, Csaba Hruska
_______________________________________________ jhc mailing list jhc@haskell.org http://www.haskell.org/mailman/listinfo/jhc