Hello,

I want to use a foreign C++ Function in a Haskell Library, and the Library in a Haskell Program.
The C++ function is separate in a file and I have a header file. 
I made a minimal reproducing repository.

The closes I have found is this repository which wraps the c++ in c and makes a full library, needing a makefile etc.
So while I think I'd get it working like that, it looks to be quite a lot to do for my simple task.

the repository structure looks as follows:

Projekt



And my (currently failing) project.cabal the following:

cabal-version: 3.0
name: cpp_lib
[...]
library
exposed-modules: CPPLib
other-extensions: ForeignFunctionInterface
build-depends: base
hs-source-dirs: lib-src
default-language: Haskell2010
include-dirs: ./cpp-src
cxx-sources: ./cpp-src/some.cpp
install-includes: ./cpp-src/some.h

executable CPPApp
main-is: program.hs
default-language: Haskell2010
build-depends: HaskellForeignCPP,
base
hs-source-dirs: program-src


The some.cpp is trivial for this case lets assume its a function multiply :: Int -> Int -> Int, and both .cpp and .h are well-formed and don't have further dependencies.

The library compiles fine, but when building the executable it fails telling me

collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

Can someone help me out?
I find very little documentation on this topic.

I know there is Inline-CPP which would help as well, but I just very much like the idea of having a nice separate file and interface for modularity.

best
Leonhard