I'm trying to write my rendering code for my application in C++ and everything else in Haskell. My C++ code links to the boost and Ogre3D libraries.
I'm trying to compile/link my Haskell program with compiled .o files in GHC to no avail, getting errors like this:
undefined reference to `Ogre::Vector3::ZERO'
The command I've come up with so far to link the code is as follows:
ghc --make Main.hs obj/Debug/BaseApplication.o obj/Debug/Application.o -lstdc++ -L"C:/Ogre/OgreSDK_MinGW_v1-8-0/bin/Debug" -L"C:/Ogre/OgreSDK_MinGW_v1-8-0/bin/Release" -I"C:/Ogre/OgreSDK_MinGW_v1-8-0/include" -I"C:/Ogre/OgreSDK_MinGW_v1-8-0/include/OGRE" -I"C:/Ogre/OgreSDK_MinGW_v1-8-0/include/OIS" -I"C:/Ogre/OgreSDK_MinGW_v1-8-0/boost" -optl-Wl -optl--enable-runtime-pseudo-reloc -optl--enable-auto-image-base -optl--enable-auto-import -optl--add-stdcall-alias -optl-mthreads
It tries to link two BaseApplication.o and Application.o, two of my files, and the Ogre3D and boost libraries as well. It also has some linker options I copied from Code::Blocks.
I know that there is a small binding to Ogre3D for Haskell (http://hackage.haskell.org/package/hogre), but I am a beginner with the library and all of the resources for learning the library are written in C++; I don't want to have the barrier of having to translate it to Haskell as well.
How do I link external C++ libraries to my Haskell code? To be clear, I am using a C wrapper over the C++ routines to ensure that the names aren't mangled by the compiler, and I am using the FFI. Am I using the wrong options to provide directories for Haskell or is there something I'm missing?
In case you are using your own wrapper, here's link to such project: Low level C Ogre3D Interface.
As for "undefined reference" errors - the libker is right, you are not passing in Ogre libs, only paths to them. Try to add -lOgreMain
or something like this.