error: 'comp' was not declared in this scope

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys,
I have my own Queue class derived from priority_queue and it has 
its own remove function defined. The problem I am facing is that 
the code worked fine before but after recently upgrading my 
Gentoo Linux kernel from 2.6.5 to 2.6.17-r7 (that also upgraded 
the gcc to 4.1.1 and glibc to 2.4-r3) code dosent compile 
successfully anymore. the compiler throws following errors:

queue.h:79: error: 'c' was not declared in this scope
queue.h:86: error: 'comp' was not declared in this scope
queue.h:86: error: there are no arguments to 'make_heap' that 
depend on a template parameter, so a declaration of 'make_heap' 
must be available

Is this happening because some configs are not set right or lib 
links are not right? How can fix this?

the code for the derived Queue class is as follows:

// a priority queue class with an additional
// method to delete elements of the queue
template<class T> class Queue:
public std:: priority_queue< T, std::vector<T>, PLess<T> >
{
public:
Queue()
{
pthread_mutex_init(&mutex,NULL);
}
~Queue()
{
pthread_mutex_destroy(&mutex);
}

// looks for an element in the queue
// deletes it and returns it
// or returns null if no such element
// is in the queue
T remove(const T& _sched )
{
QIterator iter;
T ret = NULL;
iter = std::find_if(c.begin(), c.end(),
bind1st(PEqual<T>(),_sched) );

if(iter != c.end())
{
ret = *iter;
c.erase(iter,iter+1);
make_heap(c.begin(),c.end(), comp);
}
return ret;
}

// regenerate the heap structure
void repair()
{
make_heap(c.begin(),c.end(), comp);
}

// to synchronize to access to the queue
void lock()
{ pthread_mutex_lock(&mutex); }
void unlock()
{ pthread_mutex_unlock(&mutex); }

protected:
typedef typename std::vector<T>::iterator QIterator;
pthread_mutex_t mutex;
};



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux