# Error while compiling .cpp to .dll

**URL:** https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692
**Category:** FreeFEM installation
**Created:** [April 22, 2022, 9:43am UTC](https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692 "2022-04-22T09:43:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.freefem.org/u/Carina)
#### Post date: [April 22, 2022, 9:43am UTC](https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692/1 "2022-04-22T09:43:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [April 22, 2022, 10:09am UTC](https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692/2 "2022-04-22T10:09:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.freefem.org/u/Carina)
#### Post date: [April 22, 2022, 5:45pm UTC](https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692/3 "2022-04-22T17:45:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.freefem.org/u/Carina)
#### Post date: [April 22, 2022, 6:23pm UTC](https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692/4 "2022-04-22T18:23:06Z")

</div>

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. 🙂

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

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [April 22, 2022, 6:59pm UTC](https://community.freefem.org/t/error-while-compiling-cpp-to-dll/1692/5 "2022-04-22T18:59:06Z")

</div>

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