# Types.h file not found

**URL:** <https://root-forum.cern.ch/t/types-h-file-not-found/56355>\
**Category:** Newbie\
**Created:** [September 13, 2023, 8:49am UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355 "2023-09-13T08:49:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmercier](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cmercier](https://root-forum.cern.ch/u/cmercier)\
**Post date:** [September 13, 2023, 8:49am UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/1 "2023-09-13T08:49:12Z")

</div>

Hi,  
I miss an included file `Types.h` in minuit2 stand alone installation  
How I install:

```auto
 git clone --branch latest-stable https://github.com/root-project/root.git root_src
 mkdir build_minuit2
 cd build_minuit2
 cmake -DCMAKE_INSTALL_PREFIX=../minuit2 ../root_src/math/minuit2
 make
 make install

```

Then  
I try to compile the following file (I removed the original code)

```auto
#include "Math/IFunction.h"
#include "Minuit2/Minuit2Minimizer.h"
#include "Math/Functor.h"
main () {}

```

`gcc -I ./minuit2/include/Minuit2 junk.cpp`  
In file included from ./minuit2/include/Minuit2/Math/Minimizer.h:20,  
from ./minuit2/include/Minuit2/Minuit2/Minuit2Minimizer.h:16,  
from junk.cpp:9:  
./minuit2/include/Minuit2/Math/Util.h:28:10: fatal error: **Types.h: No such file or directory**  
28 | #include “Types.h”  
| ^ ~~~~~~~~  
compilation terminated.

As Types.h is a very common name I do not know where it is supposed to find it,  
I do not have the problem if I compile the whole root project, as it find a Types.h somewhere  
I have no Types.h in the minuit2 installation directory.

What do I do wrong ?

\_Platform: fedora 37  
\_Compiler: cc (GCC) 12.3.1 20230508 (Red Hat 12.3.1-1)

* * *

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [September 13, 2023, 12:47pm UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/2 "2023-09-13T12:47:51Z")

</div>

Hello @cmercier, thanks for your report!

You need to define some undocumented preprocessor macros that standalone Minuit2 secretly needs:

```auto
gcc -DROOT_Math_VecTypes -DMATHCORE_STANDALONE -I ./minuit2/include/Minuit2 junk.cpp

```

But of course we don’t want to require our users to have to do some magic preprocessor defines for the code to work! I have prepared a fix to ROOT such that it would also compile without the defines:

> <https://github.com/root-project/root/pull/13646>
>
> The "Math/Error.h" header is not shipped with standalone Minuit2.
> 
> It is not a… perfect solution to just ship it with Minuit2, because the Error.h header behaves differently depending on the \`MATHCORE\_STANDALONE\` macro being defined or not. The code would only work correctly if the user defines the \`MATHCORE\_STANDALONE\` herself in the user code that uses standalone Minuit2, which would be annoying.
> 
> Instead, this commit proposes another solution to the problem: for all headers also used in Minuit2 standalone, MathCore
> moves the definitions of all functions that use \`Math/Error.h\` out of the header files in the cxx files. Like this, the \`Math/Error.h\` is only a build dependency of standalone Minuit2, and the user doesn't need to define the \`MATHCORE\_STANDALONE\` macro for it to work.
> 
> Including the "Math/Util.h" header needs to be avoided for similar reasons (it's about another preprocessor macro related to \`veccore\`).

This fix will make it into the next ROOT release, ROOT 6.30.

---

<div class="post-metadata">

**Author:** ![cmercier](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cmercier](https://root-forum.cern.ch/u/cmercier)\
**Post date:** [September 13, 2023, 1:54pm UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/3 "2023-09-13T13:54:48Z")

</div>

> [@jonas](#):
>
> `gcc -DROOT_Math_VecTypes -DMATHCORE_STANDALONE -I ./minuit2/inclu`

thanks a lot, that did the trick, I noticed that there are 2 libraries built, so I linked both  
but still have a problem while linking the real code  
[100%] Linking CXX executable modes\_mixed  
/usr/bin/ld: CMakeFiles/modes\_mixed.dir/modes\_mixed\_minimize.cpp.o: in function `doMn(parms const*)': /home/cmercier/TA/mixed_modes/C/modes_mixed_minimize.cpp:31: undefined reference to `ROOT::Minuit2::MnUserParameters::Add(std::\_\_cxx11::basic\_string\<char, std::char\_traits, std::allocator \> const&, double, double)’

missing something ?

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [September 13, 2023, 2:15pm UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/4 "2023-09-13T14:15:53Z")

</div>

Maybe the problem is that you used gcc, but not the C++ compiler, which is called g++? And you linked the static libraries correctly (without `-l` or `-L`)?

For your example from before, the correct command including the linking would be:

```auto
g++ -DROOT_Math_VecTypes -DMATHCORE_STANDALONE -I ./minuit2/include/Minuit2 junk.cpp minuit2/lib/libMinuit2.a minuit2/lib/libMinuit2.a

```

---

<div class="post-metadata">

**Author:** ![cmercier](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cmercier](https://root-forum.cern.ch/u/cmercier)\
**Post date:** [September 13, 2023, 3:46pm UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/5 "2023-09-13T15:46:12Z")

</div>

ok, I actually use cmake for my full project, so uses g++  
I had -L and -l defined, trying to set full path to make sure I was using the lib\*.a,  
I used the latest stable which was used to post here (instead of 6.26.10 I used before)  
do you have the trick for  
In file included from /home/cmercier/TA/minuit2/include/Minuit2/Minuit2/MinimumParameters.h:13,  
from /home/cmercier/TA/minuit2/include/Minuit2/Minuit2/MinimumState.h:13,  
from /home/cmercier/TA/minuit2/include/Minuit2/Minuit2/MinimumSeed.h:13,  
from /home/cmercier/TA/minuit2/include/Minuit2/Minuit2/FunctionMinimum.h:13,  
from /home/cmercier/TA/mixed\_modes/C/modes\_mixed\_minimize.cpp:7:  
/home/cmercier/TA/minuit2/include/Minuit2/Minuit2/MnMatrix.h:19:10: fatal error: Minuit2/MnMatrixfwd.h: No such file or directory  
19 | #include “Minuit2/MnMatrixfwd.h”  
| ^ ~~~~~~~~~~~~~~~~~~~~~~

which is not there ?

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [September 13, 2023, 4:20pm UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/6 "2023-09-13T16:20:34Z")

</div>

The only thing you can currently do is to manually fix the cmake in ROOT, or copy manually the missing header into your project.

Yet again, in ROOT 6.30 this problem will be fixed by this PR that was merged some weeks ago:

> <https://github.com/root-project/root/pull/13522>
>
> Installing missing header MnMatrixfwd.h when building standalone Minuit2.
> 
> \## …Checklist:
> 
> \- \[x\] tested changes locally
> \- \[\] updated the docs (if necessary)

---

<div class="post-metadata">

**Author:** ![cmercier](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cmercier](https://root-forum.cern.ch/u/cmercier)\
**Post date:** [September 13, 2023, 4:24pm UTC](https://root-forum.cern.ch/t/types-h-file-not-found/56355/7 "2023-09-13T16:24:58Z")

</div>

thanks,  
Actually the easiest for me is to stick with 6.26.10, until 30,  
the 2 defines you gave me above, plus adjust my CMakelist to make sure lib.a where set a the end of the command line made the job.  
thank you very much
