This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ unref symbols
- To: gcc-bugs at gcc dot gnu dot org
- Subject: g++ unref symbols
- From: Petr Ovchenkov <ptr at ParaGraph dot Ru>
- Date: Wed, 2 Aug 2000 19:13:27 +0400 (MSD)
Compiler specs (indeed problem exist on all gcc compilers since
2.95.2, don't now about earlier versions):
c360> c++ -v
Reading specs from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/2.96/specs
gcc version 2.96 20000731 (experimental)
c360> uname -a
HP-UX c360 B.11.00 A 9000/785 2002760784 two-user license
(Sun's Solaris x86 has the same problem).
Breaf description:
g++ produce UNDEF reference for inlined class member functions,
if don't see all virtual (only virtual significant) member functions.
File x1.h:
// -- x1.h
class A
{
public:
A()
{ }
virtual void qq();
};
// -- EOF x1.h
File main.cc:
// -- main.cc
#include "x1.h"
/*
void A::qq()
{
}
*/
A a;
// -- EOF main.cc
> c++ -c main.cc
> nm -C main.o
00000000 t $CODE$
U $global$
00000000 T global constructors keyed to a
U A::A(void)
00000000 t __static_initialization_and_destruction_0
40000000 D a
00000000 t gcc2_compiled.
We see, that A::A(void) 'UNDEFINED'. If we uncomment void A::qq()
in main.cc or remove word 'virtual' in x1.h, we will see
00000000 t A::A(void)
LOCAL as expected.
Significance:
Lets suppose that x1.h is header from library, and void A::qq() body
exist in library. But when we compile some other (program's) module
(say, main.cc) we find unreferenced symbols on linkage step.
Sincerely yours,
- Petr Ovchenkov