STL doesn't compile with gcc 2.8.1

Maurizio Loreti loreti@pd.infn.it
Tue Oct 19 23:13:00 GMT 1999


Raghu Angadi <angadi@my-deja.com> writes:

> ...
> g++ we have is 2.8.1
> ...
> #include <iostream.h>
> #include <queue>
> 
> int main()
> {
>     priority_queue<int> pq;
>     int i;
> 
>     while (cin >> i) {
> 	pq.push(i);
> 	cout << "top: " << pq.top();
>     }
> 
>     while (!pq.empty()) {
> 	cout << pq.top() << endl;
> 	pq.pop();
>     }
> 
>     return 0;
> }

Well, it works like a charm with my g++ 2.95.1 .  Insert a "<< endl"
in the first 'cout' statement, and a 'using namespace std;' somewhere.

-- 
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html
Univ. of Padova, Dept. of Physics - Padova, Italy            loreti@pd.infn.it


More information about the Gcc-help mailing list