* FW: compile fails with g++ 3.4.3
@ 2005-06-17 20:57 Kolev, Nik
2005-06-17 21:24 ` corey taylor
0 siblings, 1 reply; 4+ messages in thread
From: Kolev, Nik @ 2005-06-17 20:57 UTC (permalink / raw)
To: gcc-help
Hi,
I am trying to build a shared library using g++ 3.4.3
Up until now I was successfully building with 3.2.3 version of the compiler.
Since I do not have much time fixing the code to please 3.4.3 is there a way to tell 3.4.3 (via an option) to ignore certain "flaws" in the code? The first error I am getting is:
SiteClusterFinder.h:62: error: type `std::list<SiteClusterFinder<T>::E, std::allocator<SiteClusterFinder<T>::E> >' is not derived from type `SiteClusterFinder<T>'
SiteClusterFinder.h:62: error: ISO C++ forbids declaration of `iterator' with no type
thanks,
nik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FW: compile fails with g++ 3.4.3
2005-06-17 20:57 FW: compile fails with g++ 3.4.3 Kolev, Nik
@ 2005-06-17 21:24 ` corey taylor
0 siblings, 0 replies; 4+ messages in thread
From: corey taylor @ 2005-06-17 21:24 UTC (permalink / raw)
To: Kolev, Nik; +Cc: gcc-help
How did you declare the iterator?
corey
On 6/17/05, Kolev, Nik <NKolev@trueposition.com> wrote:
> Hi,
>
> I am trying to build a shared library using g++ 3.4.3
> Up until now I was successfully building with 3.2.3 version of the compiler.
>
> Since I do not have much time fixing the code to please 3.4.3 is there a way to tell 3.4.3 (via an option) to ignore certain "flaws" in the code? The first error I am getting is:
>
> SiteClusterFinder.h:62: error: type `std::list<SiteClusterFinder<T>::E, std::allocator<SiteClusterFinder<T>::E> >' is not derived from type `SiteClusterFinder<T>'
> SiteClusterFinder.h:62: error: ISO C++ forbids declaration of `iterator' with no type
>
> thanks,
> nik
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: FW: compile fails with g++ 3.4.3
@ 2005-06-17 22:19 Kolev, Nik
2005-06-18 2:46 ` corey taylor
0 siblings, 1 reply; 4+ messages in thread
From: Kolev, Nik @ 2005-06-17 22:19 UTC (permalink / raw)
To: gcc-help
I have not written the code and cannot answer specific questions - just building it as a shared library that I then call from within a java app using JNI. Here's how the template class is set up:
template <class T>
class SiteClusterFinder
{
private:
// Entry
class E
{
public:
// Constructor
E(double _x, double _y, T _userData, SiteClusterFinder *finder)
: x(_x), y(_y), userData(_userData), finder(finder)
{}
// Less operator
bool operator < (const E& e) const
{
if(finder->sortByX)
return (x < e.x);
else
return (y < e.y);
}
// x and y coordinates
double x, y;
// User data (keys)
T userData;
// Cluster finder
SiteClusterFinder *finder;
};
typedef std::list<E> L;
typedef L::iterator I; // The error happens here
typedef std::list<L> LL;
typedef LL::iterator II;
public:
friend class E;
/**
* Adds point to a cluster finder
*
* @param _x x coordinate of a new point
* @param _y y coordinate of a new point
* @param _userData data that identify a point to a user
* @param _finder site cluster finder
*/
void add(double _x, double _y, T _userData, SiteClusterFinder *_finder)
{
data.push_back(E(_x, _y, _userData, _finder));
}
/**
* Removes all points from a cluster finder
*/
void clear() { data.clear(); }
private:
// Indicates how sorting has to be done in E
bool sortByX;
// Storage of points
L data;
//
// More methods/members
//
};
#endif
>How did you declare the iterator?
>
>corey
On 6/17/05, Kolev, Nik <NKolev@trueposition.com> wrote:
> Hi,
>
> I am trying to build a shared library using g++ 3.4.3
> Up until now I was successfully building with 3.2.3 version of the compiler.
>
> Since I do not have much time fixing the code to please 3.4.3 is there a way to tell 3.4.3 (via an option) to ignore certain "flaws" in the code? The first error I am getting is:
>
> SiteClusterFinder.h:62: error: type `std::list<SiteClusterFinder<T>::E, std::allocator<SiteClusterFinder<T>::E> >' is not derived from type `SiteClusterFinder<T>'
> SiteClusterFinder.h:62: error: ISO C++ forbids declaration of `iterator' with no type
>
> thanks,
> nik
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FW: compile fails with g++ 3.4.3
2005-06-17 22:19 Kolev, Nik
@ 2005-06-18 2:46 ` corey taylor
0 siblings, 0 replies; 4+ messages in thread
From: corey taylor @ 2005-06-18 2:46 UTC (permalink / raw)
To: Kolev, Nik; +Cc: gcc-help
The issue is a key issue addressed in the 3.4 release so you won't be
able to simply ignore the code.
The error message is annoyingly confusing sometimes, but it means that
you are missing the 'typename' keyword in front of the type
declaration.
typedef typename L::iterator l;
corey
On 6/17/05, Kolev, Nik <NKolev@trueposition.com> wrote:
> I have not written the code and cannot answer specific questions - just building it as a shared library that I then call from within a java app using JNI. Here's how the template class is set up:
>
> template <class T>
> class SiteClusterFinder
> {
> private:
>
> // Entry
> class E
> {
> public:
> // Constructor
> E(double _x, double _y, T _userData, SiteClusterFinder *finder)
> : x(_x), y(_y), userData(_userData), finder(finder)
> {}
>
> // Less operator
> bool operator < (const E& e) const
> {
> if(finder->sortByX)
> return (x < e.x);
> else
> return (y < e.y);
> }
>
> // x and y coordinates
> double x, y;
>
> // User data (keys)
> T userData;
>
> // Cluster finder
> SiteClusterFinder *finder;
> };
>
> typedef std::list<E> L;
> typedef L::iterator I; // The error happens here
> typedef std::list<L> LL;
> typedef LL::iterator II;
>
> public:
>
> friend class E;
>
> /**
> * Adds point to a cluster finder
> *
> * @param _x x coordinate of a new point
> * @param _y y coordinate of a new point
> * @param _userData data that identify a point to a user
> * @param _finder site cluster finder
> */
> void add(double _x, double _y, T _userData, SiteClusterFinder *_finder)
> {
> data.push_back(E(_x, _y, _userData, _finder));
> }
>
> /**
> * Removes all points from a cluster finder
> */
> void clear() { data.clear(); }
>
> private:
>
> // Indicates how sorting has to be done in E
> bool sortByX;
>
> // Storage of points
> L data;
>
> //
> // More methods/members
> //
> };
>
> #endif
>
>
> >How did you declare the iterator?
> >
> >corey
>
> On 6/17/05, Kolev, Nik <NKolev@trueposition.com> wrote:
> > Hi,
> >
> > I am trying to build a shared library using g++ 3.4.3
> > Up until now I was successfully building with 3.2.3 version of the compiler.
> >
> > Since I do not have much time fixing the code to please 3.4.3 is there a way to tell 3.4.3 (via an option) to ignore certain "flaws" in the code? The first error I am getting is:
> >
> > SiteClusterFinder.h:62: error: type `std::list<SiteClusterFinder<T>::E, std::allocator<SiteClusterFinder<T>::E> >' is not derived from type `SiteClusterFinder<T>'
> > SiteClusterFinder.h:62: error: ISO C++ forbids declaration of `iterator' with no type
> >
> > thanks,
> > nik
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-18 2:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-17 20:57 FW: compile fails with g++ 3.4.3 Kolev, Nik
2005-06-17 21:24 ` corey taylor
2005-06-17 22:19 Kolev, Nik
2005-06-18 2:46 ` corey taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).