Mail Archives: djgpp/1997/06/05/00:23:40
I am having trouble in coding a priority queue in gcc 2.7.2 or gcc 2.7.2.1
It gives me the following error
heap.h: In function __push_heap_aux(int *,int *,struct greater<int>,int *):
heap.h: line 57: type unification failed for function template
This problem doesn't occur in the gcc 2.7.2. or gcc 2.7.2.1 in Linux or
other UNIX boxes. I have checked the include file (heap.h) and found that
it is identical with the UNIX boxes.
Currently, I suspect it may be due to some installation problem in my
DJGPP(DOS).
I install DJGPP by coping and uncompressing the following files
lgp271b.zip
bnu27b.zip
gpp2721.zip
gcc2721.zip
djdev201.zip
I hope some of you can solve my problem. I have attached my testing code
at the end of this mail
----------------------------------------------------------------------------
#include <iostream.h>
#include <stack.h>
#include <vector.h>
int main()
{
// Program to test out heapsort
int data[]={5,4,3,2,1};
int i;
// Compiler failed in this declaration for DJGPP(DOS)
// works in gcc(UNIX)
priority_queue < vector<int>, greater<int> > q;
for (i=0;i<5;i++)
{
q.push(data[i]);
}
// Get the sorted output
for (i=0;i<5;i++)
{
cout << q.top() << endl;
q.pop();
}
return 0;
}
- Raw text -