
3 Jul
2007
3 Jul
'07
8:28 a.m.
On Tue, 2007-07-03 at 12:36 +0200, Srđan Stipić wrote:
I wanted to compile simple Haskell program (simple.hs) to .c and after that to target platform (x86).
I did the following things:
ghc -C simple.hs mv simple.hc simple.c gcc -c simple.c -I/usr/lib/ghc-6.6/include/
And I got the following error message: [...] How to compile .hc files with gcc?
One way to find out is to ask ghc how it does it! :-) ghc -fvia-C -v -c simple.hs this will produce lots of output including the gcc command that ghc uses to compile the C code and then assemble it to a .o file. It's probably best however, just to use ghc to compile your .hs files to .o files, and especially to do the final link, since it does need quite a large set of gcc flags. Duncan