This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in compilation or link phase of egcs (C++, 2.91.0), Linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]