Hello, everyone. I've got a compiler error popping up for this class:

#include <iostream>
#include <string>

class Stage
{
private:
	string var;
public:
	Stage();
	Stage(int num_of_items);
};

The error is:

error C2146: syntax error : missing ';' before identifier 'var'

The funny thing is that if I remove the line "string var", it works fine. Any ideas?

It could be that string is defined in namespace std, which you forgot to declare that you are using.

Either that or declare-- using std::string or-- std::string var;

commented: Seems like a good idea to me. +18
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.