user570593
user570593

Reputation: 3520

C++ struct error - error C2061: syntax error : identifier

This is my code:

struct opts
{
   int a;
   int b;
};
class myclass
{
  private:
           opts options;
 public:
       void afunction();
}

//myclass.cpp
void myclass::afunction()
{
     if options.a==1
           //do something
}

When I compile it I am getting the follwoing error.

error C2061: syntax error : identifier options

What is wrong with it?

Upvotes: 0

Views: 1242

Answers (1)

Luchian Grigore
Luchian Grigore

Reputation: 258678

 if options.a==1

is wrong. The condition has to be surrounded by parenthesis.

 if (options.a==1)

Upvotes: 4

Related Questions