as i´m starting with root, i try to compile some of the examples in /test, which should work without problems, as far as i can understand.
but i allways get compiler-errors, that “_isnan” and “_finite” are undeclared in “TMath”. (e.g. in “Hello.cxx”).
as a workaround i tried to include , which led to a big variety of linker errors, saying that the references to all methods in the classes used are not defined.
this is probably a very silly problem but nevertheless one that i can´t get rid of, so i´m asking for help.
Which version of ROOT are you using? On which platform? Have you set ROOTSYS and LD_LIBRARY_PATH before to compile the examples in $ROOTSYS/test directory?
sorry, my information weren´t very exhaustive.
i installed root 5.02/00 to use within the cygwin-bash under windows2000.
i tried to compile “hello.cxx” with mingw/gcc3.4.2, telling it to search for libraries in $rootsys/lib (and for completeness also in $rootsys/cint/lib).
Hi,
mingw ("–no-cygwin") is not supprted. User the “regular” cygwin gcc instead. If what I’m saying doesn’t make sense to you then lpease provide us with the exact lines you were executing, so I can copy & paste and run it and see the error message.
Axel.
when i type in what you suggested, then i get a huge error message, by far too long to be cited here. for an idea i just put the first few lines here:
collect2: ld terminated with signal 1 [Hangup]
$ROOTSYS/lib/libCore.dll.a:misc-inst.cc:(.text+0x51550c): multiple definition of TObject::operator new(unsigned int)' /Temp/cc7K3ggY.o:hsimple.cxx:(.text$_ZN7TObjectnwEj[TObject::operator new(unsigned int)]+0x0): first defined here $ROOTSYS/lib/libCore.dll.a:crtstuff.c:(.idata+0xd28): multiple definition of__imp__G__globalvarpointer’
$ROOTSYS/lib/libCore.dll.a:crtstuff.c:(.idata+0xd28): first defined here
$ROOTSYS/lib/libCore.dll.a:crtstuff.c:(.idata+0xa78): multiple definition of __imp__optind' $ROOTSYS/lib/libCore.dll.a:crtstuff.c:(.idata+0xa78): first defined here $ROOTSYS/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x0): multiple definition of___do_sjlj_init’
$ROOTSYS/lib/libCore.dll.a:misc-inst.cc:(.text+0x0): first defined here
with any recent root version please also use the following compiler flags:
-pipe -Wall -Woverloaded-virtual -D_DLL -I/usr/X11R6/include
and these linker flags;
-Wl,–enable-auto-import -Wl,–enable-runtime-pseudo-reloc -L/usr/X11R6/lib
You are compiling and linking in one go - at least for testing purposes it’s better to split that up. So please try g++ `root-config --cflags` -pipe -Wall -Woverloaded-virtual -D_DLL -I/usr/X11R6/include -c $ROOTSYS/test/hsimple.cxx
g++ `root-config --glibs` -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -L/usr/X11R6/lib $ROOTSYS/test/hsimple.o -o $ROOTSYS/test/hsimple
Or you could just run “cd $ROOTSYS/test; make hsimple.exe”.
Axel.
good news is, that the method suggested by axel works fine on the pc of my colleague. the bad news is, that neither of the two work on my pc.
in both cases i get this while linking (compiling does what it should):
/cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xd28): multiple definition of __imp__G__globalvarpointer' /cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xd28): first defined here /cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xa78): multiple definition of__imp__optind’
/cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xa78): first defined here
/cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x0): multiple definition of ___do_sjlj_init' /cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x0): first defined here /cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x1082): multiple definition of_G__int_cast’
/cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b1890): first defined here
/cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x354f): multiple definition of `_G__exec_tempfile’
/cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b17b0): first defined here
the main diffrence between the two pcs is that my root was installed from binaries. is that a problem?
Hi,
could you post the exact line you tried to execute? Could you run “rm hsimple.o hsimple.exe; make hsimple.exe”, and send the output, including the lines executed by make? What g++ version do you use (g++ --version)?
Cheers, Axel.
g++ -O -pipe -Wall -Woverloaded-virtual -I/usr/X11R6/include -D_REENTRANT -MD -I/cygdrive/d/Root/include -c hsimple.cxx
g++ -O -Wl,–enable-auto-import -Wl,–enable-runtime-pseudo-reloc -L/usr/X11R6/lib hsimple.o -L/cygdrive/d/Root/lib -Wl,-u,_G__cpp_setupG__Hist -Wl,-u,_G__cpp_setupG__Graf1 -Wl,-u,_G__cpp_setupG__G3D -Wl,-u,_G__cpp_setupG__GPad -Wl,-u,_G__cpp_setupG__Tree -Wl,-u,_G__cpp_setupG__Rint -Wl,-u,_G__cpp_setupG__PostScript -Wl,-u,_G__cpp_setupG__Matrix -Wl,-u,_G__cpp_setupG__Physics -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lpthread -lm -o hsimple.exe
/cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xd28): multiple definition of __imp__G__globalvarpointer' /cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xd28): first defined here /cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xa78): multiple definition of__imp__optind’
/cygdrive/d/Root/lib/libCore.dll.a:crtstuff.c:(.idata+0xa78): first defined here
/cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x0): multiple definition of ___do_sjlj_init' /cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x0): first defined here /cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x1082): multiple definition of_G__int_cast’
/cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b1890): first defined here
/cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x354f): multiple definition of _G__exec_tempfile' /cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b17b0): first defined here /cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x3aa9): multiple definition of_G__load_text’
/cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b1900): first defined here
/cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x161b8): multiple definition of _G__close_inputfiles' /cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b1720): first defined here /cygdrive/d/Root/lib/libCint.dll.a:streambuf-inst.cc:(.text+0x16d81): multiple definition of_G__const_setnoerror’
/cygdrive/d/Root/lib/libCore.dll.a:misc-inst.cc:(.text+0x4b1740): first defined here
i posted only the first few lines of the error-log which is roughly 6mb big…
looks like you’re right - this seems to be a mismatch between the compiler version used for the binary distribution and your compiler. With my root built from sources I cannot reproduce this problem either. So you’ll have to build root from sources, I’m afraid…
with root build from sources (which became possible with the hints mentioned in the topic “Probably a simple problem…” in this forum) everything works just fine!