I am trying to get the following code to compile using g++ 4.2.1 and am receiving the following errors
CODE:
#include <iostream>
#include <queue>
using namespace std;
int main (int argc, char * const argv[])
{
queue<int> myqueue();
for(int i = 0; i < 10; i++)
myqueue.push(i);
cout << myqueue.size();
return 0;
}
ERRORS:
main.cpp: In function ‘int main(int, char* const*)’:
main.cpp:10: error: request for member ‘push’ in ‘myqueue’, which is of non-class type ‘std::queue<int, std::deque<int, std::allocator<int> > > ()()’
main.cpp:12: error: request for member ‘size’ in ‘myqueue’, which is of non-class type ‘std::queue<int, std::deque<int, std::allocator<int> > > ()()’
Any ideas as to why? I tried in Eclipse, X-Code and through the terminal.