Event class instantiation issue- cannot open include files

Hi All,
I am relatively new to ROOT, and seem to be having some issues relating to the ROOT filesystem setup. I am trying to create a data structure for anaylsing tests run on a pixel sensor chip, I am thinking each pixel could be represented by a branch, storing position and threshold data etc, but before I can work on this I am encountering a more fundamental issue, I cannot instnatiate an Event class. This is because my installation cannot find the /test folder in which the required header files are contained. I am using ROOT 5.34.36 on windows 7 64 bit, and have configured my Environment variables to include a $ROOTSYS. I am using the code below (as found in one of the tutorial macros) to call the include files (currently starting with $ROOTSYS, I have also tried the full address on disk to no avail).

#if defined(__CINT__) && !defined(__MAKECINT__)
#include "$ROOTSYS\test\libEvent.so"
#else
#include "$ROOTSYS\bin\Event.h"
#endif

Apologies if the solution is patently obvious, full code not included as Iā€™m 99% sure this is why my Event objects will not instantiate.

Thanks in advance and Regards

In your installation, what is the list of directories in $ROOTSYS?

My current ā€œVariable Valueā€ for ROOTSYS is C:\root_v5.34.36, it had previously been set to C:\root_v5.34.36\bin, with exactly the same errors resulting.

Fair enough and what is the content of the directory C:\root_v5.34.36 ?

Itā€™s just the standard installation directory, contains both the /bin and /test folders needed for those header files, as well as all macros and tutorials etcā€¦

Then:

#if defined(__CINT__) && !defined(__MAKECINT__)
#include "$ROOTSYS\test\libEvent.so"
#else
#include "$ROOTSYS\test\Event.h"
#endif

should work without problem

OK, glad Iā€™m not going completely mad! I set my $ROOTSYS just using windows advanced system settings, do I need to edit thisroot.bat to contain the path also?

Edit: I can find the Event.h file in test no problem, but cannot find any file called libEvent (format .so or otherwise) anywhere in the ROOT directory, is this normal and the file is created by the program as an when needed? I have also tried simply using #include "$ROOTSYS\test\Event.h" with no luck.

Edit 2: I can navigate to %ROOTSYS% in cmd and show all files using dir (is the $ only meant for use on unix systems?), but ROOT still cannot find files in this directory, even with the macro adjusted to use %ROOTSYS% instead of $ROOTSYS

but cannot find any file called libEvent (format .so or otherwise)

Did you download the ROOT binary or build it your self?

At any rate, you can try ( cd $ROOTSYS/test; make) if using cygwin or (cd %ROOTSYS%; nmake) if not, to build libEvent.dll)

Cheers,
Philippe.

I downloaded the binary. Trying the cmd I get ā€œnmake is not recognised as an external program command or batch fileā€, Iā€™ll get back to you on the cygwin method, I need to configure my cygwin properly so make works.
Cheers!

Got cygwin working properly but the problem persists.
Cygwin terminal output:

$ cd $ROOTSYS/test; make
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
/cygdrive/c/root_v5.34.36/bin/root-config: line 420: test: command: integer expr                                                                                                                                                                                               ession expected
cl.exe  -O2 -nologo -IC:/root_v5.34.36/include -FIw32pragma.h -MD -GR -GX -G5 -I                                                                                                                                                                                               'C:\root_v5.34.36\include' -c Event.cxx
make: cl.exe: Command not found
make: *** [Makefile:836: Event.obj] Error 127


I didnā€™t know VC was expanding unix-style environment variables these days?

And shouldnā€™t the path delimiter be / as "\t" is interpreted as a tab etc?

At any rate - it might be easier to use gSystem->AddIncludePath() / gInterpreter->AddIncludePath() to help the compiler / CINT find the header.

Axel.

Hi Axel,
Iā€™ve tried using both / and \ delimiters, I was pretty confused as to whether root running in windows requires windows style paths, and it seems so as using / results in an arithmetic (divided by zero) error. The AddIncludePath functions seem promising but suffer from exactly the same issue as the includes in my macro, root canā€™t ā€˜seeā€™ the windows paths it seems. Use of paths starting with %ROOTSYS% or %ROOTSYS result in syntax errors (fine, root wants use of $ROOTSYS) However using this correct syntax still results in could not open file errors.
Is it likely a clean install of ROOT would help, would it be advantageous to compile it myself as opposed to downloading the binaries?

Having installed visual studio properly (why nmake wasnā€™t working, clearly) and clean installing Root (again from binaries) I am unable to run nmake in the test directory with the error (from VS command prompt)

C:\root_v5.34.36\test>nmake

Microsoft (R) Program Maintenance Utility Version 14.10.25017.0
Copyright (C) Microsoft Corporation.  All rights reserved.

makefile(10) : fatal error U1033: syntax error : '=' unexpected
Stop.

With line 10 of the makefile being

RC     := root-config

The MSDN documentation for this error states "If a macro definition in the makefile contained an equal sign (=) without a preceding name or if the name being defined is a macro that expands to nothing, the following error occurs:"
So Iā€™m assuming the problem lies in the fact that root-config ā€œexpands to nothingā€? Does this need to be edited in order to work properly?

use nmake -f Makefile.win32 to compile the examples in the $(ROOTSYS)/test directory (i.e. the Windows nmake makefile is Makefile.win32)

So close to working now! This results in error U1052 (win32.mak not found). Searching over my entire C: drive it seems like Microsoft have stopped bothering to include it in new releases of VS (Iā€™m using the newest one) but I think (hope) installing windows SDK should sort it.

This is because youā€™re using a version of Visual Studio which is not supported (too recent one). You cannot use a version more recent than Visual Studio 2012 (and it has to match the version used to build ROOT anywayā€¦)

OK cheers for the heads up, foolish of me to assume microsoft having decent backward compatability :stuck_out_tongue_winking_eye:. Certainly learning why scientists prefer unix!

Finally got everything building! Thank you everyone for the help, Iā€™m so much more enlightened now about the backdoor OS-related stuff to programming that was never touched in my prior Java coding classes!

1 Like

And apologies for not following up on this - thanks Bertrand for jumping in!

Axel.

And I was obviously wrongā€¦ The latest supported version is Visual Studio 2013 (and not 2012). Sorry about thatā€¦

Cheers, Bertrand.

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