Going nuts with templates and libstdc++

Lavoie Philippe lavoie@yoho.genie.uottawa.ca
Wed May 5 14:04:00 GMT 1999


At one point templates where the answer, no they are more and more of
a nightmare.

My program compiles fine under Solaris. It fails because I'm
initializing a pointer to 0 under Linux and on DEC Alpha, removing a
few template lines solves all linking problems.

The only thing common is that we all are using egcs1.1.2

You can download my program (NURBS++)
http://yukon.genie.uottawa.ca/~lavoie/software/nurbs/download.shtml

I should never have tried using deque in my program...

Anyway, under Linux the latest problem is

c++ -shared  f_nurbs.lo f_nurbsS.lo f_curve.lo f_surface.lo f_hnurbsS.lo matrixRT.lo f_nurbs_sp.lo f_nurbsS_sp.lo f_hnurbsS_sp.lo nurbsGL.lo f_nurbsArray.lo f_nurbsSub.lo f_tri_spline.lo  -lc  -Wl,-soname -Wl,libnurbsf.so.0 -o .libs/libnurbsf.so.0.1.0
/usr/local/lib/libstdc++.a(stlinst.o): In function `__malloc_alloc_template<0>::oom_malloc(unsigned int)':
/home/lavoie/app/egcs-1.1.2/i686-pc-linux-gnu/libstdc++/stl/stl_alloc.h:186: multiple definition of `__default_alloc_template<true, 0>::start_free'
f_nurbsSub.lo:/home/lavoie/project/nurbs++-3.0.4/nurbs/nurbsSub.cc:59: first defined here
/usr/local/lib/libstdc++.a(stlinst.o): In function `__malloc_alloc_template<0>::oom_malloc(unsigned int)':
/home/lavoie/app/egcs-1.1.2/i686-pc-linux-gnu/libstdc++/stl/stl_alloc.h:186: multiple definition of `__default_alloc_template<true, 0>::end_free'
f_nurbsSub.lo:/home/lavoie/project/nurbs++-3.0.4/nurbs/nurbsSub.cc:59: first defined here
....

the line in question is

surf = 0 ;

where surf is defined as 

NurbSurface<T> *surf ;  

and NurbSurface is 

template <class T> class NurbSurface ;


How am I suppose to fix this problem ? Removing the line is not an
option. The strangest thing is that the same line worked with 1.1.2
just 2 weeks ago. I'll post an update if I can fix it.

Phil


More information about the Gcc-bugs mailing list