Fatal error: TFile.h: No such file or directory

I’ve just switched my computer from windows to linux (Mint 18.1 x64) and am having some issues getting my macros to run- namely ROOT is unable to find any of the header files not native to C++ (ie IOstream is located without issue but TFIile cannot be found), both in interpreted and compiled modes. Root was installed using the terminal input sudo apt-get install root-system, to install root 5.34, and root can successfully be launched from the terminal. I have set my environment variables using ehrice@Eris-LinuxMint / $ export ROOTSYS=/usr/lib/x86_64-linux-gnu/root5.34 ehrice@Eris-LinuxMint / $ export PATH=$ROOTSYS/bin:$PATH ehrice@Eris-LinuxMint / $ export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PAT. I am confident this is an easy fix, and apologies in advance, I’m an absolute noob with regards to the linux file system and have found it hard to find a definitive answer as to where root is installed.
I have tried building (making?) the lib directory but this yeilded no useful results, only make: *** No rule to make target 'win32api\winfunc.h', needed by '..\include\win32api.dll'. Stop.

You can locate root by the following:

root-config --prefix


which root

How are you compiling / interpreting your macros? Are you running them from the ROOT prompt, using a make file, or using cmake? Are you using gcc as a compiler? Without this information the following are just some possible routes.

You can use root-config to provide the include directories and libraries to the compiler

root-config --incdir --libs

ROOT provides a CMake package for getting the necessary libraries and include directories


If you are using gcc you can set the environment variables CPLUS_INCLUDE_PATH and LIBRARY_PATH. man gcc for more information.

Finally, why are you using the Windows win32api on a linux machine?

(PS. you can post code blocks here by using three back ticks to start the block and three to end the block.)

which root does display what seems to be a correct installation path (at least more convincing than my previous) of /usr/bin/root, however using the export ROOSYS command with this path does not fix the issue.

I am running my macros compiled from the directory in which the respective macros/raw data files are in the root console using root .x mymacro.c+, however interpereted macros cannot locate the required files either.
I have not installed any compilers other than what ever gcc version(s) were packaged with my distro, looking at my package manager my version is 4:5.3.1-1ubuntu1.

root-config --incdir --libs

yields: /usr/include/root -L/usr/lib/x86_64-linux-gnu -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic
but find_package(ROOT) results in a bash syntax error.
I will try these CPLUS include and LIBRARY path options. I was equally confused about why those windows api files came up.

This is meant to be used with a makefile for compilation. In your case you can ignore these suggestions.

This is meant to be used in a CMakeLists.txt file, also not relevant for your situation.

I believe that you need simply to use the following from the bash prior to launching ROOT:

source `root-config --prefix`/bin/thisroot.sh

Most users will simply add this command to their .bash_profile (I prefer environment modules, but that might be too complicated).

source /path/to/root/bin/thisroot.sh

Thanks for the clarification! I knew it was most likely a very simple thing like that. One issue still remains though, when I run:
sourceroot-config --prefix/bin/thisroot.sh

bash tells me
bash: /usr/bin/thisroot.sh: No such file or directory

I’ve searched in /usr/bin to see if this file does actually exist, and it looks like it doesn’t, in this case can it be copied from elsewhere and changed as required for my system or does it need to built?

I tried to save you some hassle in trying to find the root prefix by using root-config extract it, this did not seem to work with your installation. You will need to find the directory where thisroot.sh lives. You can try the following (this may take some time depending on your system).

find / -name thisroot.sh 2>/dev/null

and use then once you have the correct path you can use the command

source /path/to/root/bin/thisroot.sh

You may want to do yourself a favor and updagrade to ROOT 6 and build it from source.

Running this command does not return anything, searching my system does not take long either as it’s a fresh install. Yeah, having already spent days of my life trying to configure environment variables for root on a variety of operating systems I think I might give ROOT 6 a go, tried installing it from binaries earlier and got quite confused about where to put everything but I’ll try from source, will be exciting to encounter the wonderful world of TTreeReaders!
Will the ROOT 6 install overwrite/update my ROOT 5 files or will i need to manually remove these? (Would be very annoying having ROOT 6 installed but booting to a broken copy of ROOT 5 every time I launch it)

The thisroot.sh script does not return any message. It simply sets the environment variables need to run ROOT. Open it in a text editor and take a look.

If you are planning on running multiple versions of root consider environment modules. It has a bit of a learning curve, but I think it is well worth the investment. I’d be happy to post my modules if someone is in need.

Good luck with ROOT 6. There is a guide for building ROOT.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.