[ROOT] Multiple definition of member function?

From: Chris Hayward (cchaywar@umich.edu)
Date: Wed Aug 06 2003 - 19:44:02 MEST


Hello,
I am using ROOT 3.05/07 with gcc 2.96 on lxplus. I have defined a class
with member functions that are for the most part defined in-line. However,
I do have one defined in my .cxx file. This function has caused me to get
the following error when trying to compile:

/tmp/ccPP4bRM.o: In function `Chamber::CalculateMeans(void)':
/tmp/ccPP4bRM.o(.text+0x0): multiple definition of
`Chamber::CalculateMeans(void)'
/tmp/cccSwL9F.o(.text+0x0): first defined here
/tmp/ccGXmfh0.o: In function `Chamber::CalculateMeans(void)':
/tmp/ccGXmfh0.o(.text+0x0): multiple definition of
`Chamber::CalculateMeans(void)'
/tmp/cccSwL9F.o(.text+0x0): first defined here
collect2: ld returned 1 exit status

However, it works fine when I interpret the code in interactive mode. I
have tried to follow the Event example, but I still cannot get it to work.
The relevant parts of the header and implementation are below.

Thank you in advance for your help,
Chris

Chamber.h:

    Chamber() { //here the constructor is defined}
   ~Chamber() {};               //default destructor
    void CalculateMeans();

//below are a bunch of getters and setters that worked fine before I added
//Calculate Means


Chamber.cxx:

#include "/afs/cern.ch/user/x/xtomo/SoftWare/chris/Chamber.h"

//needed for ROOT I/O
ClassImp(Chamber);

void Chamber::CalculateMeans()

{ //here is the function. error occurs even with empty brackets. }



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