C++ Shared Libary Linking Problem
Ivan_Watkins@tivoli.com
Ivan_Watkins@tivoli.com
Wed Dec 6 12:45:00 GMT 2000
I have some C++ files that I'm attempting to place into a shared library.
However, the linker is complaining that there are multiple definitions of
my
class methods.
./objects/linux/dependent.o: In function `Sequence::Sequence(void)':
./objects/linux/dependent.o(.text+0x0): multiple definition of
`Sequence::Sequence(void)'
./objects/linux/sequence.o(.text+0x0): first defined here
./objects/linux/dependent.o: In function `Sequence::~Sequence(void)':
./objects/linux/dependent.o(.text+0x40): multiple definition of
`Sequence::~Sequence(void)'
./objects/linux/sequence.o(.text+0x40): first defined here
./objects/linux/dependent.o: In function `Sequence::grow(void)':
./objects/linux/dependent.o(.text+0x88): multiple definition of
`Sequence::grow(void)'
./objects/linux/sequence.o(.text+0x88): first defined here
There is only ONE place that I define the methods of the Sequence class
and that is in sequence.o which is created from sequence.cxx and
sequence.h.
depedendent.o incudes a header file that defines another C++ class called
GlobalAuth. GlobalAuth has some data members that are of type
Sequence "Class". and that is the connection that dependent.o has to the Sequence class.
Why am I getting these multiple definition errors when I try to link sequence.o and dependent.o into a single shared library? Do I need to specify a
certain compile option when I want to create C++ object modules that will become part of a shared library?
Regards,
Ivan Watkins
IBM Tivoli SecureWay Development
RTP Bldg. 502- J109 Dept. JEUA
Research Triangle Park, North Carolina 27709-1295
(919) 254-7364 T/L 444-7364
(919) 254-4239 - Fax
IWATKINS@US.IBM.COM
More information about the Gcc-help
mailing list