0

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?

1
  • 6
    You're missing a ; after class myclass {...}. Commented Nov 20, 2012 at 15:09

1 Answer 1

4
 if options.a==1

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

 if (options.a==1)
Sign up to request clarification or add additional context in comments.

1 Comment

This is of course another problem with the code, but it's weird that it's accepted, since the issue pointed out by DCoder in a comment seems to be the root cause of the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.