I am trying to use root in eclipse but I can’t figure it how. Has someone done this before?
I set include and add the result of root-config --libs into mt c/c++ build/setting /library but when I I try to import library I got :
make all
Building file: ../src/Cern.c
Invoking: GCC C Compiler
gcc -I/home/jadidi/Downloads/root/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Cern.d" -MT"src/Cern.d" -o"src/Cern.o" "../src/Cern.c"
In file included from /home/jadidi/Downloads/root/include/Rtypes.h:30,
from /home/jadidi/Downloads/root/include/TObject.h:31,
from /home/jadidi/Downloads/root/include/TNamed.h:26,
from /home/jadidi/Downloads/root/include/TBranch.h:28,
from /home/jadidi/Downloads/root/include/TTree.h:30,
from ../src/Cern.c:12:
/home/jadidi/Downloads/root/include/Rtypeinfo.h:32: fatal error: typeinfo: No such file or directory
compilation terminated.
make: *** [src/Cern.o] Error 1
It does not seem to be strictly related to root nor to eclipse: it seems the compiler is missing the typeinfo header, which is a standard c++ header that should be present in system include folders. In my system it is in:
/usr/include/c++/4.8.1/typeinfo
The compiler should automatically find it, so I guess you may have a broken gcc installation. BTW, I routinely use root with eclipse since years, so it is definitely feasible.
and add root-config --libs to linker miscellanoeus. but now I am getting:
and I also LD_LIBRARY_PATH to debug and run env .
but I can’t run c code I got this :
[code]
**** Build of configuration Debug for project cp ****
make all
Building file: …/src/cp.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c root-config --cflags -fmessage-length=0 -MMD -MP -MF"src/cp.d" -MT"src/cp.d" -o"src/cp.o" "…/src/cp.c"
In file included from /usr/local/include/root/Rtypes.h:30,
from /usr/local/include/root/TObject.h:31,
from /usr/local/include/root/TNamed.h:26,
from /usr/local/include/root/TFormula.h:27,
from /usr/local/include/root/TF1.h:27,
from …/src/cp.c:13:
/usr/local/include/root/Rtypeinfo.h:32: fatal error: typeinfo: No such file or directory
compilation terminated.
make: *** [src/cp.o] Error 1[/code]
I am also thinking to start working in eclipse-ROOT. I haven’t started and I don’t have any experience, so I cannot help, but I have found this tutorial how to set ROOT in eclipse, it might be of help.
My settings are pretty straightforward. For each profile (Debug, Release) I set both:
C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Includes
and
C/C++ Build->Settings->Tool Settings->GCC C Compiler->Includes
to ${ROOTSYS}/include/root, having set the ROOTSYS environment variable before launching Eclipse. For the linker options I set
C/C++ Build->Settings->Tool Settings->GCC C++ Linker->Miscellaneous->LinkerFlags
to root-config --libs (including the `). This is all you need to use root under eclipse. However, as I wrote in my previous post, your problem with typeinfo header doesn’t seem to be related to a misconfiguration of root.
I don’t know if this has been resolved, but you are calling gcc with a *.c file. gcc will treat that as C, not C++, and not look at the C++ includes (this includes typeinfo.h). Renaming cp.c to cp.cpp is probably the quickest fix. It is my experience with Eclipse that it will call g++ given a .cpp file (though I believe gcc would do it internally, anyway).
Also, out of frustration, I wrote my own tutorial on configuring Eclipse for ROOT (after learning things the hard way). And this seems like a good thread to peddle it as any, since it’s what pops up when I search for “configure eclipse”…
I want to start coding with eclipse, can you tell me where to find your tutorial?? The link is no longer working! I have tried to set everything from my own, but I haven’t succeeded