delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/05/00:23:40

From: eng30262 AT leonis DOT nus DOT sg (CHEA CHEE KEONG)
Newsgroups: comp.os.msdos.djgpp
Subject: STL problem in gcc
Date: 5 Jun 1997 02:35:08 GMT
Organization: National University of Singapore
Lines: 57
Message-ID: <5n58ks$ai4@nuscc.nus.sg>
NNTP-Posting-Host: eng30262 AT leonis DOT nus DOT sg
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019