Configure eclipse

Hi,

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

Can you tell me what is wrong here?

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.

can you please tell me your setting? I had the typeinfo header. I can run the code in c++ by following settings

C/C++ Build-> C++ compiler -> miscellanoeus : -c `root-config --cflags` -fmessage-length=0

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

can you please tell me your setting? I had the typeinfo header. I can run the code in c++ by following settings

C/C++ Build-> C++ compiler -> miscellanoeus : -c `root-config --cflags` -fmessage-length=0

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. :mrgreen:

http://agenda.nikhef.nl/getFile.py/access?contribId=12&resId=1&materialId=slides&confId=91

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.

well it is strange because I can run any C/C++ using gcc. but when I import one of root header file I got this error.

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”…

Tutorial

Hi kkaess,

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

Thank you for sharing.

Art2

Hi Arturo,

Yeah, UMN recently retired the old webspaces. Here’s a link to it on my google drive:

https://drive.google.com/file/d/1AF0fKR83rtR_NQJ1gZjG1HjTZdn4kSke/view?usp=sharing

Good luck,
K

1 Like

Hi @kkaess,

Thanks a lot!!! I hope I can manage it!!

Many thanks!