# C++ Macro in ROOT Does Not Terminate Properly

**URL:** <https://root-forum.cern.ch/t/c-macro-in-root-does-not-terminate-properly/21234>\
**Category:** ROOT\
**Created:** [June 1, 2016, 6:38am UTC](https://root-forum.cern.ch/t/c-macro-in-root-does-not-terminate-properly/21234 "2016-06-01T06:38:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![scheong](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@scheong](https://root-forum.cern.ch/u/scheong)\
**Post date:** [June 1, 2016, 1:14pm UTC](https://root-forum.cern.ch/t/c-macro-in-root-does-not-terminate-properly/21234/3 "2016-06-01T13:14:59Z")

</div>

[quote=“Pepe Le Pew”]1. Try to precompile your macro using ACLiC, in order to find source code problems, e.g. try something like (inspect all reported warnings and errors):  
root [0] .x Function.C++

1. You can “debug” many problems using “valgrind”. See, for example: [Segmentation Fault depending on linux distribution](https://root-forum.cern.ch/t/segmentation-fault-depending-on-linux-distribution/18020/6)

BTW. Instead of “openFile-\>Close();”, you should have “delete openFile;”[/quote]

1. I tried .x Function.C++, and all I get are error messages because C++ does not understand types like TFile, TMath, TTree, etc. There is no error otherwise.

2. I used delete openFile; instead. The program still does not terminate; the print statements right before and after are both printed properly.

---

_[View the full topic](https://root-forum.cern.ch/t/c-macro-in-root-does-not-terminate-properly/21234)._
