Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stack definition problem 2

Status
Not open for further replies.

MvanH

Technical User
May 15, 2001
19
0
0
NL
goodmorning,

I'm trying to use a stack in my program.
However somethings go's wrong when I declarete my stack in my class the following way:

-- stack<int> stackname;

I recieve the following errors.

-- syntax error : missing ';' before '<'
-- error C2501: 'stack' : missing storage-class or type
specifiers
-- error C2059: syntax error : '<'
-- error C2238: unexpected token(s) preceding ';'

I used #include <stack> so that can't be the problem.

Does anybody know what I did wrong?

Thanks,
Martini
 
Yep already did that,
but that was not the problem.

When I type stack< I do see the 'autoformat' text
that tells me what I should fill in.
But somehow the compeiler doesnt like the idee of a stack.

could it have something to do with the settings of Microcoft Visual C++???

Thanks
 
try to
using namespace std;
after including John Fill
1c.bmp


ivfmd@mail.md
 
Yes, John is right, I didn't have the error because I already had the:
using namespace std;
in the program where I tested your problem.


s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Thanks the problem was indeed &quot;Using namespace std&quot;

I would have never guessed that THAT was the problem.
Thanks again for your help!
(It seems that its always the same two guys who help me out. Thanks a lot John & Burtanl)

Martini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top