Error while compiling .cpp to .dll

While trying to compile a new finite element from .cpp to .dll via cygwin and the command ff-c++ I always get the error: fatal error: umfpack.h not found. But I already reinstalled the packages for umfpack.h and it still tells the same error. What do I need to change?

Here the response of cygwin in detail:

$ ff-c++ mf3.cpp
Window without cygwin
g++ -c ‘-I/cygdrive/c/Program Files (x86)/FreeFem++/include’ -g -O2 -I/usr/include/mingw -I/usr/include/mingw -DNDEBUG -O3 -mtune=generic -std=c++14 -DBAMG_LONG_LONG -DNCHECKPTR -I/mingw64/ff-petsc/r/include ‘mf3.cpp’
In file included from /cygdrive/c/Program Files (x86)/FreeFem++/include/SparseLinearSolver.hpp:9,
from /cygdrive/c/Program Files (x86)/FreeFem++/include/ff++.hpp:36,
from mf3.cpp:1:
/cygdrive/c/Program Files (x86)/FreeFem++/include/VirtualSolverSparseSuite.hpp:10:10: fatal error: umfpack.h: No such file or directory
10 | #include <umfpack.h>
| ^~~~~~~~~~~
compilation terminated.

What do you have in the folder /mingw64/ff-petsc/r/include?

I’m using cygwin, not mingw, so I don’t have a mingw64 folder. But I also couldn’t find an ff-petsc folder in cygwin64. But the umfpack.h is in cygwin64/usr/include/suitesparse if this is of any help.

Ok i actually got to solve the problem with the packages, but I still get an error: undefined reference to `map_type’
collect2: error: ld returned 1 exit status

What does this error mean and how do I solve this error?
I still don’t get an .dll file, but an .o file, which is already a step forward. :slight_smile:

Here the skript in detail:
$ ff-c++ -cygwin mf3.cpp
cygwin-version
g++ -c ‘-I/cygdrive/c/Program Files (x86)/FreeFem++/include’ -g -O2 -I/usr/include/mingw -I/usr/include/mingw -DNDEBUG -O3 -mtune=generic -std=c++14 -DBAMG_LONG_LONG -DNCHECKPTR -I/mingw64/ff-petsc/r/include ‘mf3.cpp’

g++ -shared -g -O2 -I/usr/include/mingw -I/usr/include/mingw -DNDEBUG -O3 -mtune=generic -std=c++14 -DBAMG_LONG_LONG -DNCHECKPTR -I/mingw64/ff-petsc/r/include ‘mf3.o’ -o mf3.dll ‘/cygdrive/c/Program Files (x86)/FreeFem++/libff.dll’
/usr/lib/gcc/x86_64-pc-cygwin/11/…/…/…/…/x86_64-pc-cygwin/bin/ld: mf3.o:mf3.cpp:(.rdata$_ZTV7E_F_F0_IddE[_ZTV7E_F_F0_IddE]+0x68): undefined reference to E_F0::Optimize(std::deque<std::pair<E_F0*, int>, std::allocator<std::pair<E_F0*, int> > >&, std::map<E_F0*, int, E_F0::kless, std::allocator<std::pair<E_F0* const, int> > >&, unsigned long&)' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: mf3.o:mf3.cpp:(.rdata$_ZTV10E_F0_Func1[_ZTV10E_F0_Func1]+0x68): undefined reference to E_F0::Optimize(std::deque<std::pair<E_F0*, int>, std::allocator<std::pair<E_F0*, int> > >&, std::map<E_F0*, int, E_F0::kless, std::allocator<std::pair<E_F0* const, int> > >&, unsigned long&)’
/usr/lib/gcc/x86_64-pc-cygwin/11/…/…/…/…/x86_64-pc-cygwin/bin/ld: mf3.o:mf3.cpp:(.rdata$.refptr.map_type[.refptr.map_type]+0x0): undefined reference to `map_type’
collect2: error: ld returned 1 exit status

This is not expected to work. You’ll need to cross-compile with MinGW compilers. An easier path would be to simply use MSYS.