This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug in compilation or link phase of egcs (C++, 2.91.0), Linux
- To: egcs-bugs at cygnus dot com
- Subject: Bug in compilation or link phase of egcs (C++, 2.91.0), Linux
- From: Klaas Teschauer <klaas at kite dot rhein-main dot de>
- Date: Thu, 13 May 1999 22:25:20 +0200
Description
A program generated with egcs (g++) cannot be linked
correctly. However, this can be rectified by excluding a header file
from the compilation. The code contained in this header file is _not_
referenced in the source file being compiled, it can be correctly
compiled and linked without it.
Successful compilation and linking:
kite:~/project$ make treetest
g++ -g -Wall -c Option.cc -o Option.o
g++ -g -Wall -c treetest.cc -o treetest.o
g++ -o treetest Option.o treetest.o
kite:~/project$
Including another header file from the project, patch to
`treetest.cc':
*** treetest.cc-ok Thu May 13 22:06:05 1999
--- treetest.cc Thu May 13 22:10:13 1999
***************
*** 2,6 ****
#include <iostream>
! // #include "ContextTree.h"
class OptC : public Option
--- 2,6 ----
#include <iostream>
! #include "ContextTree.h"
class OptC : public Option
------------------------------------------------- end of patch
When the project is now compiled again, the linking stage fails:
kite:~/project$ make treetest
g++ -g -Wall -c Option.cc -o Option.o
g++ -g -Wall -c treetest.cc -o treetest.o
g++ -o treetest Option.o treetest.o
treetest.o: In function `global destructors keyed to OptC::s':
/usr/include/g++-2/std/bastring.h:164: undefined reference to `ContextTree::~ContextTree(void)'
collect2: ld returned 1 exit status
make: *** [treetest] Error 1
kite:~/project$
Environment:
Operating system: Debian Linux 2.1 (slink) on Intel i386 architecture,
Kernel version 2.0.36, output of g++ --version: egcs-2.91.0
Source package is enclosed. The compiler was installed as part of the
Debian system and not modified in any way.
Klaas Teschauer
project.shar