[Haskell-cafe] FFI, C/C++ and undefined references

DNM dnmehay at gmail.com
Wed Jan 13 23:25:54 EST 2010


Malcolm,

I saw this suggestion somewhere else.  Unfortunately, it didn't help either.
I still get the "undefined reference" errors.  I did eventually get ghc to
compile
Main.hs by putting the -c and -cpp flags after "--make Main.hs".

Then it produces a Main.o file which (even with +x permissions on my Linux
box) will not run. I just get the message "cannot run binary file", or some
such 
message.

No explanation given.

Any ideas?

Best,
Dennis


Malcolm Wallace wrote:
> 
>> But when I try to compile it (after having successfully compiled the  
>> C code
>> with g++), I get:
>>
>> $ ghc --make Main.hs
> 
> You are not telling ghc to link against the C/C++ code,  e.g.
>      ghc --make Main.hs srilm.o
> 
> Regards,
>      Malcolm
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

-- 
View this message in context: http://old.nabble.com/FFI%2C-C-C%2B%2B-and-undefined-references-tp27139612p27156254.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list