Thank you for your comment,
about error lines: ~ 3000 of undefined reference to almost all the ROOT classes methods (operator new, delete for many TClasses). These are generated by the linker (collect2: ld returned 1 exit status)
about -lRoot:
is a normal linking option for the inclusion of the static library libRoot.a, a fundamental ROOT library.
The correction proposed seems don’t solve the problem,
Alberto
[quote]Thank you for your comment,
about error lines: ~ 3000 of undefined reference to almost all the ROOT classes methods (operator new, delete for many TClasses). These are generated by the linker (collect2: ld returned 1 exit status)
[/quote]
Yes, because you specify wrong options in command line for linker.
Very interesting news. Are you sure, you have the libRoot.a file? Have you ever seen someone linking with libRoot ? I have both linux and windows versions of root, and none of them has such library. Just look at samples, which libraries you need to link. For example, -lCore, -lHist etc.
lRoot is something new
Did you really try it to fix linker’s errors? It was a simple remark about your C++ code, of course, it will not help to linker. )
PS. I think, even after you link with ROOT’s libraries correctly (try -lCore for example instead of -lRoot), you still need to link to C++ library.
yes I’m sure, It’s a construction of mine with all the root shared libraries. Until this Fortran question the inclusion of this library doesn’t give any problem.
Your proposal to use the standard inclusion library (as -lCore) seems to resolve the problem, so I think that there is something wrong in the construction of my libRoot.a.
[quote=“alberto”]Thank you for your comment,
about error lines: ~ 3000 of undefined reference to almost all the ROOT classes methods (operator new, delete for many TClasses). These are generated by the linker (collect2: ld returned 1 exit status)
. . .
The correction proposed seems don’t solve the problem,
Alberto[/quote]
Dear Alberto,
your example:
g++ -Wall -c -I/amssw/root4/include sample.cxx
g77 -o sample sample.f sample.o -L/amssw/root4/lib -lRoot -lnsl -lcrypt -lssl -ldl -lfreetype
suggests you tried to create sample.o object file from the C++ code sample.cxx and then you tried to create the object file with the same name “sample.o” from the fortran code sample.f. Can you choose the different names for your C++ and Fortran counterparts and try to build executable using "g++
rather “g77”. Something like this:
g77 -c samplef.f
g++ -o sample sample.cxx samplef.o `root-config --glibs` `cernlib`
If by some reason you have no “cernlib” script availble you can use