# Create ROOT file

**URL:** <https://root-forum.cern.ch/t/create-root-file/39140>\
**Category:** Newbie\
**Created:** [April 28, 2020, 1:33pm UTC](https://root-forum.cern.ch/t/create-root-file/39140 "2020-04-28T13:33:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fateme](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/f19dbf/32.png) [@Fateme](https://root-forum.cern.ch/u/Fateme)\
**Post date:** [April 28, 2020, 1:33pm UTC](https://root-forum.cern.ch/t/create-root-file/39140/1 "2020-04-28T13:33:28Z")

</div>

I wanna to create a root file. Actually I wanna to create Ntuple, but I have an error massage with TFile. The error massage is: incomplete type is not allowed.  
May some one help me?

```auto
TFile* F = new TFile("test.root", "RECREATE");

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 28, 2020, 2:30pm UTC](https://root-forum.cern.ch/t/create-root-file/39140/2 "2020-04-28T14:30:26Z")

</div>

> [@Fateme](#):
>
> but I have an error massage with TFile.

Which error message ?

---

<div class="post-metadata">

**Author:** ![Fateme](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/f19dbf/32.png) [@Fateme](https://root-forum.cern.ch/u/Fateme)\
**Post date:** [April 28, 2020, 7:29pm UTC](https://root-forum.cern.ch/t/create-root-file/39140/3 "2020-04-28T19:29:46Z")

</div>

As I said I have an incomplete type error but I don’t know what is wrong.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 29, 2020, 8:00am UTC](https://root-forum.cern.ch/t/create-root-file/39140/4 "2020-04-29T08:00:34Z")

</div>

can you post a small macro reproducing the problem ?

---

<div class="post-metadata">

**Author:** ![Fateme](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/f19dbf/32.png) [@Fateme](https://root-forum.cern.ch/u/Fateme)\
**Post date:** [April 29, 2020, 9:01pm UTC](https://root-forum.cern.ch/t/create-root-file/39140/5 "2020-04-29T21:01:43Z")

</div>

This the first part of my code. When I wanna to create a TFile I have error massage.

#include “TApplication.h”  
#include “TNtuple.h”  
#include “TCanvas.h”  
#include “TGraph.h”  
#include “TLeaf.h”  
#include “TH1I.h”

using namespace std;

void ReadFromTTree() {

```
const int NrSamples = 500000;
const int NrSamplesPerEvent = 5000;
int NrEvents = NrEvents = NrSamples / NrSamplesPerEvent;

int Amplitude[NrEvents][NrSamplesPerEvent];

TFile* file = new TFile("Fille.root");
TTree* tree = (TTree*)file->Get("myTree");
```

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 29, 2020, 9:12pm UTC](https://root-forum.cern.ch/t/create-root-file/39140/6 "2020-04-29T21:12:21Z")

</div>

At least:

```cpp
#include "TFile.h"
#include "TTree.h"

```

---

<div class="post-metadata">

**Author:** ![Fateme](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/f19dbf/32.png) [@Fateme](https://root-forum.cern.ch/u/Fateme)\
**Post date:** [April 30, 2020, 11:35am UTC](https://root-forum.cern.ch/t/create-root-file/39140/7 "2020-04-30T11:35:32Z")

</div>

Thank you, I didn’t know TFile has a library. The problem solved 🙂
