STL stack w/ primitive data types

bridged with qdn.public.devtools
Post Reply
Stephen Lau

STL stack w/ primitive data types

Post by Stephen Lau » Thu Nov 21, 2002 7:24 pm

I have the following test program:
#include <iostream>
#include <stl.h>
#include <stack>
#include <vector>
#include <list>

int main()
{
list<int> test;
vector<int> foo;
stack<int> bar;
}

when I try to compile it, I get:
[steve@localhost steve]$ QCC a.cc
a.cc: In instantiation of `Stack<int>':
a.cc:11: instantiated from here
a.cc:11: `int' is not a class, struct, or union type
a.cc:11: template argument 1 is invalid
cc: /usr/lib/gcc-lib/ntox86/2.95.3/cc1plus error 33

So I can declare lists and vectors of primitive data
types like 'int', but for some reason it doesn't like
me doing it with stacks. Does anyone know why this is?
It seems like strange behaviour to me.

cheers,
steve

Kris Warkentin

Re: STL stack w/ primitive data types

Post by Kris Warkentin » Thu Nov 21, 2002 7:38 pm

This seems to be related to the dinkum headers. If you compile with
something like:

QCC -Vgcc_ntox86 -Y_gpp

where the -Y_gpp tells qcc to use the gnu c++, it works. We'll take a look
at it here internally. Thank you very much for the bug report.

cheers,

Kris

"Stephen Lau" <slau@qm.com> wrote in message
news:arjbas$q7o$1@inn.qnx.com...
I have the following test program:
#include <iostream
#include <stl.h
#include <stack
#include <vector
#include <list

int main()
{
list<int> test;
vector<int> foo;
stack<int> bar;
}

when I try to compile it, I get:
[steve@localhost steve]$ QCC a.cc
a.cc: In instantiation of `Stack<int>':
a.cc:11: instantiated from here
a.cc:11: `int' is not a class, struct, or union type
a.cc:11: template argument 1 is invalid
cc: /usr/lib/gcc-lib/ntox86/2.95.3/cc1plus error 33

So I can declare lists and vectors of primitive data
types like 'int', but for some reason it doesn't like
me doing it with stacks. Does anyone know why this is?
It seems like strange behaviour to me.

cheers,
steve

Stephen Lau

Re: STL stack w/ primitive data types

Post by Stephen Lau » Thu Nov 21, 2002 8:42 pm

Hi Kris,
This fixed my problem! Thanks much for the quick response.

cheers,
steve

Kris Warkentin wrote:
This seems to be related to the dinkum headers. If you compile with
something like:

QCC -Vgcc_ntox86 -Y_gpp

where the -Y_gpp tells qcc to use the gnu c++, it works. We'll take a
look
at it here internally. Thank you very much for the bug report.

cheers,

Kris

"Stephen Lau" <slau@qm.com> wrote in message
news:arjbas$q7o$1@inn.qnx.com...
I have the following test program:
#include <iostream
#include <stl.h
#include <stack
#include <vector
#include <list

int main()
{
list<int> test;
vector<int> foo;
stack<int> bar;
}

when I try to compile it, I get:
[steve@localhost steve]$ QCC a.cc
a.cc: In instantiation of `Stack<int>':
a.cc:11: instantiated from here
a.cc:11: `int' is not a class, struct, or union type
a.cc:11: template argument 1 is invalid
cc: /usr/lib/gcc-lib/ntox86/2.95.3/cc1plus error 33

So I can declare lists and vectors of primitive data
types like 'int', but for some reason it doesn't like
me doing it with stacks. Does anyone know why this is?
It seems like strange behaviour to me.

cheers,
steve

Kris Warkentin

Re: STL stack w/ primitive data types

Post by Kris Warkentin » Thu Nov 21, 2002 9:13 pm

"Stephen Lau" <slau@qm.com> wrote in message
news:arjft0$20u$1@inn.qnx.com...
Hi Kris,
This fixed my problem! Thanks much for the quick response.
Well, it didn't FIX your problem. I only masked it by showing you how to
use a different set of C++ libs and headers. If nothing else, however, it
will keep you working until we get a fix up and you can go back to Dinkum.
(or you can stick with GNU...whatever floats your boat ;-)

cheers,

Kris

Post Reply

Return to “qdn.public.devtools”