This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: nurbs cannot be compiled with gcc 3.4
> e7677215@est.fib.upc.edu wrote:
>
> > I need to install nurbs++-3.0.11 compiling it with gcc 3.4...., it
> > can be compiled with gcc 3.3 but it cannot be compiled with gcc 3.4,
> > it returns a lot of errors. I soved some problems of templates, but
> > there's one I can't solve :
> >
> > nurbs.cpp: In member function `BasicList<PLib::Point_nD<T, D> >
> > PLib::NurbsCurve<T, N>::tesselate(T, BasicList<T>*) const [with T =
> > float, int N = 3]':
> > f_nurbs.cpp:56: instantiated from here
> > nurbs.cpp:5252: error: no matching function for call to
> > `BasicList<PLib::Point_nD<float, 3>
> >>>> BasicList(BasicList<PLib::Point_nD<float, 3> >)'
> > ../matrix/list.h:128: note: candidates are:
> > BasicList<T>::BasicList(BasicList<T>&) [with T =
> > PLib::Point_nD<float, 3>] nurbs.cpp: In member function
> > `BasicList<PLib::Point_nD<T, D> > PLib::NurbsCurve<T,
> > N>::tesselate(T, BasicList<T>*) const [with T = float, int N = 2]':
>
>
> Looks like you are attemping to bind a temporary to a non-const reference.
> This
> is invalid. More to the point, a copy constructor should always be declared
> as
> A(A const &), not A(A&). BasicList<T>'s copy constructor seems to violate
> this.
>
> BTW, when upgrading to 3.4, http://gcc.gnu.org/gcc-3.4/changes.html can be
> very
> helpful.
>
> Giovanni Bajo
>
>
Well, I don't know what I'm doing wrong but I can't compile it. Here are the
functions :
from nurbs.cpp :
template <class T, int N>
BasicList< Point_nD<T,N> > NurbsCurve<T,N>::tesselate(T tolerance,BasicList<T>
*uk) const{
BasicList< Point_nD<T,N> > list, list2 ;
NurbsCurveArray<T,N> ca ;
decompose(ca) ;
if(ca.n()==1){
// get the number of steps
T u = 0 ;
Point_nD<T,N> maxD(0) ;
Point_nD<T,N> prev ;
Vector< Point_nD<T,N> > ders(2) ;
deriveAt(u,1,ders) ;
prev = ders[1] ;
int i ;
for(i=1;i<11;++i){
u = T(i)/T(10) ;
deriveAt(u,1,ders) ;
Point_nD<T,N> delta = ders[1]-prev ;
delta.x() = absolute(delta.x()) ;
delta.y() = absolute(delta.y()) ;
delta.z() = absolute(delta.z()) ;
maxD = maximumRef(maxD,delta) ;
prev = ders[1] ;
}
const T sqr2 = T(1.414241527) ;
int n = (int)rint(sqr2*norm(maxD)/tolerance) ;
n+=2 ;
if(n<3) n = 3 ;
for(i=0;i<n;++i){
u = (U[U.n()-deg_-1]-U[deg_])*T(i)/T(n-1) + U[deg_] ;
list.add(pointAt(u)) ;
if(uk)
uk->add(u) ;
}
return list ;
}
else{
for(int i=0;i<ca.n();++i){
list2 = ca[i].tesselate(tolerance,uk) ; <------------ line 5252
// remove the last point from the list to elliminate
list.erase((BasicNode<Point_nD<T,N> >*)list.last()) ;
list.addElements(list2) ;
}
}
return list ;
}
from list.h :
template <class T>
BasicList<T>::BasicList(BasicList<T> const &a): BasicNode<T>() { <---- line 128
first_ = last_ = 0 ;
current = first_ ;
*this = a ;
nc = 0 ;
n = 0 ;
}
What's wrong?
Thanks.