- Oct 12, 1999
- 2,157
- 0
- 71
So i wrote a templated stack to use with a program that unfortunately is due tomorrow, yes I am an idiot. I then wrote a simple test program for it, but I am getting an unfamilar compiler error.
#include <IOSTREAM.H>
#include "stack.h"
int main()
{
Stack <int> test;
for (int i=0; i<=11; ++i)
{
test.push(i);
}
for (int i=0; i<11; --i)
{
cout << "Peek " << test.peek() << endl;
}
for (int i=0; i<13; --i)
{
cout << "Pop " << test.pop() << endl;
}
return 0;
}
this is the error i get when i compile now
`g++: Compilation of header file requested
Anyone know why I'm getting this?
I think i fixed the other one, i forgot to declare what type of stack it would be <int>.
#include <IOSTREAM.H>
#include "stack.h"
int main()
{
Stack <int> test;
for (int i=0; i<=11; ++i)
{
test.push(i);
}
for (int i=0; i<11; --i)
{
cout << "Peek " << test.peek() << endl;
}
for (int i=0; i<13; --i)
{
cout << "Pop " << test.pop() << endl;
}
return 0;
}
this is the error i get when i compile now
`g++: Compilation of header file requested
Anyone know why I'm getting this?
I think i fixed the other one, i forgot to declare what type of stack it would be <int>.