User defined Handles cause "multiple definition" linking error

Hello everybody,

I implemented Handles via the Standard_DefineHandle.hxx macros as described in Romans blog [ http://opencascade.blogspot.com/2008/11/open-cascade-handles-lets-handle... ]. Now I encounter the following problem: I have two classes from which one includes the other. The definition of class A uses the DefineHandle macros. That is, classA.hxx is included in classA.cxx and in classB.hxx which causes the linker to exit with an "multiple definition of" error.
How can I overcome this error? How can I link these classes into one shared library?

I attached an simple classA-classB-example.

Thanks in advance,

Dennis

Etienne's picture

Hi Dennis,
try to move the IMPLEMENT_ statement from the .hxx file into the corresponding .cxx file

Dennis G.'s picture

It worked!

Thank you Etienne.