bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ld: undefined reference to unused function


From: Alexander Bernauer
Subject: ld: undefined reference to unused function
Date: Mon, 20 Sep 2004 19:33:37 +0200
User-agent: Mutt/1.5.6+20040722i

Hi

I think I found a bug in the gnu-linker.
I attached an archive of a test c++ project, that causes the problem.
The main files are:

lib2.h   : declares classC
lib2.cpp : defines classC
liblib2.a: the library consisting of classC

lib.h    : declares classA and classB
lib.cpp  : defines classA and classB
           classB uses a classC object from lib2
           classA doesn't
liblib.a : the library consisting of classA and classB 

main.cpp  : the main program uses a classA object

When building the application whithout linking liblib2.a to it, the linker
complains about undefined references concerning classC. But it should not
complain, as classC is not needed (as no classB object is ever defined)

I did two tests on the following environments:

GNU ld version 2.14.90.0.7 20031029 Debian GNU/Linux
g++ (GCC) 3.3.4 (Debian)
Linux 2.6.5 i686 GNU/Linux

GNU ld version 2.15.90.0.1.1 20040303 (SuSE Linux)
g++ (GCC) 3.3.3 (SuSE Linux)
Linux 2.6.7 i686 athlon i386 GNU/Linux

To reproduce the problem unpack the attached archive and say 'make'.

If you need any further information feel free to ask.

regards

--
Alexander Bernauer
address@hidden
www.logi-track.com

Attachment: ldtest.tar.bz2
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]