I'm trying to do the following from Chapter 5 of "Real World Haskell":
Our choice of naming for the source file and
function is deliberate. To create an executable, ghc
expects a module named Main
that contains a
function named main
. The
main
function is the one that will be
called when we run the program once we've built it.
ghc -o simple Main.hs SimpleJSON.o
When I do that, I get this error:
C:\ch05>ghc -o simple Main.hs SimpleJSON.o
[2 of 2] Compiling Main ( Main.hs, Main.o )
Linking simple.exe ...
SimpleJSON.o:fake:(.data+0x0): multiple definition of `SimpleJSON_getArray_closure'
.\SimpleJSON.o:fake:(.data+0x0): first defined here
SimpleJSON.o:fake:(.text+0x54): multiple definition of `SimpleJSON_getArray_info'
.\SimpleJSON.o:fake:(.text+0x54): first defined here
SimpleJSON.o:fake:(.data+0x4): multiple definition of `SimpleJSON_getObject_closure'
.\SimpleJSON.o:fake:(.data+0x4): first defined here
What's going wrong here?