This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
970929 linking problems w/ -g
- To: egcs-bugs at cygnus dot com
- Subject: 970929 linking problems w/ -g
- From: Jay Sachs <sachs at bull dot cs dot williams dot edu>
- Date: Wed, 08 Oct 1997 12:37:01 -0400
[This is on Solaris 2.5.1]
First off, unlike the previous snapshot I've been using (0907), I get
referencing errors from ld on functions whose names did not
"unmangle". (this is with the c++filt that got built w/ 970929). I
can't come up with a small test case, though I'd be happy to ftp the
source somewhere if it'd be of help.
Anyway, on to some things I've been able to whittle down to size:
//----------------------------------------------------------------------
// z.cc
#include <map>
#include <set>
class D {
public:
bool operator<(const D &) const { return true; }
bool operator==(const D &) const { return true; }
};
int main()
{
map<int,D> m;
set<map<int,D> > s;
s.insert(m);
}
//----------------------------------------------------------------------
when compiled yields:
bulldozer% g++ z.cc
Undefined first referenced
symbol in file
operator<(map<int, D, less<int>, __default_alloc_template<false, 0> > const &, map<int, D, less<int>, _
_default_alloc_template<false, 0> > const &)/var/tmp/cca006jh1.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
The offending function is BTW defined to be inline in map.h
Another problem is given the two files x.cc and y.cc:
//----------------------------------------------------------------------
// x.cc
#include <vector>
class C {
};
class D : public C {
};
int main()
{
vector<D> vd(10);
vector<C> vc(vd.begin(),vd.end());
return 0;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// y.cc
#include <vector>
class C {
};
class D : public C {
};
template class vector<C>;
template class vector<D>;
//----------------------------------------------------------------------
when manually instantiating the templates, the build fails:
bulldozer% g++ -fno-implicit-templates -c x.cc
bulldozer% g++ -c y.cc
bulldozer% g++ y.o x.o
Undefined first referenced
symbol in file
C * __uninitialized_copy_aux<D *, C *>(D *, D *, C *, __false_type)x.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Perhaps this is the fault of manually instantiating templates? Should
I need to force the instantiation of __uninitialized_copy_aux myself?
This didn't happen w/ 970907.
-Jay