[ROOT] Another operator in namespace question....

From: Ray Fliller III (rfliller@bnl.gov)
Date: Fri May 30 2003 - 16:54:38 MEST


  Hello ROOTers,

    I am using ROOT cvs from Tuesday May 27 in Linux.

    I previously reported a problem with operators in namespaces which was
fixed. Thanks Philippe!  But I have uncovered the "next level" in you
will... :-)

    I have a namespace FOO, With a class bug, no overloaded 
operators, compiled into its own library. Fine.
    I have another namespace ONU, with a class onme that
inherits from FOO::bug.  There is a friend  overloaded uniary
minus for bug.  This is compiled into ints own library and dynamically
linked to FOO::bug's library.  Fine so it seems.

    Here in lies the problem.  If I try to link the ONU::onme library to
another library or problem I get the following error....

g++ -O2 -Wall -fPIC -D_REENTRANT -I/opt/cern/root/include -c bug.cxx
Generating dictionary bugDict.cxx...
/opt/cern/root/bin/rootcint -f bugDict.cxx -c bug.h bugLinkDef.h
g++ -O2 -Wall -fPIC -D_REENTRANT -I/opt/cern/root/include -c bugDict.cxx
g++ -shared  -Wl,-soname,libBug.so -L/opt/cern/root/lib -lNew -lCore
-lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix
-lPhysics -lpthread -lm -ldl -rdynamic -L/opt/cern/root/lib -lCore -lCint
-lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix
-lPhysics -lGui -lpthread -lm -ldl -rdynamic -L/home/rainman/rfliller/ROOT
bug.o bugDict.o -o libBug.so


FOO::bug library generated......


g++ -O2 -Wall -fPIC -D_REENTRANT -I/opt/cern/root/include -c onme.cxx
Generating dictionary onmeDict.cxx...
/opt/cern/root/bin/rootcint -f onmeDict.cxx -c onme.h onmeLinkDef.h
g++ -O2 -Wall -fPIC -D_REENTRANT -I/opt/cern/root/include -c onmeDict.cxx
g++ -shared  -Wl,-soname,libOnMe.so -L/opt/cern/root/lib -lNew -lCore
-lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix
-lPhysics -lpthread -lm -ldl -rdynamic -L/opt/cern/root/lib -lCore -lCint
-lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix
-lPhysics -lGui -lpthread -lm -ldl -rdynamic -L/home/rainman/rfliller/ROOT
-L\. -lBug onme.o onmeDict.o -o libOnMe.so


ONU::onme library generated.....

Now link to a program....

g++ -O2 -Wall -fPIC -D_REENTRANT -I/opt/cern/root/include   -c -o dummy.o
dummy.cc
g++ -L/opt/cern/root/lib -lNew -lCore -lCint -lHist -lGraf -lGraf3d -lGpad
-lTree -lRint -lPostscript -lMatrix -lPhysics -lpthread -lm -ldl -rdynamic
-L/opt/cern/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree
-lRint -lPostscript -lMatrix -lPhysics -lGui -lpthread -lm -ldl -rdynamic
-L/home/rainman/rfliller/ROOT -L\. -lBug -lOnMe dummy.o -o dummy
./libOnMe.so: undefined reference to `ONU::operator-(ONU::onme &)'
collect2: ld returned 1 exit status
make: *** [dummy] Error 1
rm onmeDict.cxx bugDict.cxx

Attached is code that illustrates the problem at hand.  Thank you for the
time!

(Just for the record - I didn't do this! I just have to get root to work
with it! :-)

-- 

 RAINMAN
      "How much does a piece of gum cost Ray?"
      "About $100."
      "How much does a new car cost Ray?"
      "`Bout $100."
      "There goes working for NASA!"

==================================================================
Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124 
C-A Accelerator Physics            Dept. Fax: (631)-344-5954
Building 911B
Brookhaven National Lab
Upton, NY 11973                    Office: Room 211

http://www.agsrhichome.bnl.gov/People/rfliller/
==================================================================





This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET