Hi,
I got a multiple definition problem, compiling my test program under NUE
with sgi++. The problem appears only,
if I include iostream.h in both helloClass.h and helloClass.cxx. Is
there any compiler option to avoid this ?
Thanks in advance
Thomas
hello.o: In function `virtual function thunk (delta:-8) for
_IO_ostream_withassign::~_IO_ostream_withassign(void)':
hello.o(.text+0x4b0): multiple definition of `virtual function thunk
(delta:-8) for _IO_ostream_withassign::~_IO_ostream_withassign(void)'
helloClass.o(.text+0x420): first defined here
hello.o: In function `virtual function thunk (delta:-16) for
_IO_istream_withassign::~_IO_istream_withassign(void)':
hello.o(.text+0x580): multiple definition of `virtual function thunk
(delta:-16) for _IO_istream_withassign::~_IO_istream_withassign(void)'
helloClass.o(.text+0x4f0): first defined here
hello.o: In function `virtual function thunk (delta:-24) for
iostream::~iostream(void)':
hello.o(.text+0x650): multiple definition of `virtual function thunk
(delta:-24) for iostream::~iostream(void)'
helloClass.o(.text+0x5c0): first defined here
hello.o: In function `virtual function thunk (delta:-16) for
istream::~istream(void)':
hello.o(.text+0x720): multiple definition of `virtual function thunk
(delta:-16) for istream::~istream(void)'
helloClass.o(.text+0x690): first defined here
hello.o: In function `virtual function thunk (delta:-8) for
ostream::~ostream(void)':
hello.o(.text+0x920): multiple definition of `virtual function thunk
(delta:-8) for ostream::~ostream(void)'
helloClass.o(.text+0x890): first defined here
collect2: ld returned 1 exit status
uname -a
Linux mp-pc45 2.2.4 #1 SMP Wed Jun 23 13:23:12 MEST 1999 ia64 unknown
sgicc -version
SGIcc Compilers: Version 0.01.0-9
--
Thomas Guenther Tel:+49-621-292-3085
Volume Graphics GmbH Fax:+49-621-292-5756
Kraemergasse 14/1 Email:guenther@xxxxxxxxxxxxxxxxxx
D-69117 Heidelberg http://www.volumegraphics.com
#include <stdio.h>
#include <helloClass.h>
main()
{
helloWorld h;
h.output();
}
#include <helloClass.h>
#include <iostream.h>
void
helloWorld::
output()
{
cout << str;
}
#include <iostream.h>
class helloWorld
{
public:
helloWorld() { strcpy(str,"huhu");};
virtual ~helloWorld() {};
void output();
private:
char str[200];
};
|